public static void UpdateItem(APIDetailPanel postedItem) { var editedModel = DetailPanelList.GetData().First(i => i.ID == postedItem.ID); editedModel.Items = postedItem.Items; editedModel.Unit = postedItem.Unit; editedModel.Quantity = postedItem.Quantity; editedModel.UnitPrice = postedItem.UnitPrice; editedModel.Total = postedItem.Total; }
public ActionResult DetailPanelPartialUpdate(MVC.Areas.Purchasing.Models.APIDetailPanel item) { var model = new object[0]; if (ModelState.IsValid) { try { // Insert here a code to update the item in your model DetailPanelList.UpdateItem(item); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_DetailPanelPartial", DetailPanelList.GetData())); }
public static void AddItem(APIDetailPanel postedItem) { DetailPanelList.GetData().Add(postedItem); }