I have a ASP MVC API Controller that returns a IEnumerable array as JSON but I do not get the key name for the array all I get is
[1]
0: {
$id: "1"
id: 1
itemid: "Flame 19#Bag Acosta Produce Ctn A"
descrip: "Flame grape very suite on Carton Box"
createdate: "2013-11-17T06:26:50.047"
/...
I need the key for inventory like below,
inventory:[1]
0: {
$id: "1"
id: 1
itemid: "Flame 19#Bag Acosta Produce Ctn A"
descrip: "Flame grape very suite on Carton Box"
createdate: "2013-11-17T06:26:50.047"
/...
Code
public class DtoController : ApiController
{
private ProduceServiceContext db = new ProduceServiceContext();
public IEnumerable<InventoryDTO> MapInventories()
{
return from i in db.Inventories
select new InventoryDTO() { id = i.InventoryId, createdate = i.CreateDate ?? DateTime.MinValue, descrip = i.Descriptions,
itemid = i.ItemDetail, gtin = i.GTIN, lastcost = i.LastCost
/...