Exemplo n.º 1
0
 // POST api/values
 public void Post(ListItem listItem)
 {
     //var products = (Array)HttpContext.Current.Session["products"];
     var listItems = (List<ListItem>)HttpContext.Current.Application["products"];
     int ix = listItems.FindIndex(i=>i.id==listItem.id);
     //var item = listItems.FirstOrDefault(i => i.id == listItem.id);
     listItems[ix]=listItem;                
     HttpContext.Current.Application["products"] = listItems;
 }
Exemplo n.º 2
0
 // PUT api/values/5
 public void Put(ListItem listItem)
 {
     var listItems = (List<ListItem>)HttpContext.Current.Application["products"];
     listItems.Add(listItem);
     HttpContext.Current.Application["products"] = listItems;
 }