public void AddItem(APIGTOrder postedItem) { List <APIGTOrder> list = GetData(); postedItem.Code = (list.Count + 1); list.Add(postedItem); }
public void UpdateItem(APIGTOrder postedItem) { var editedModel = GetData().First(i => i.Code == postedItem.Code); editedModel.Code = postedItem.Code; editedModel.OrderDate = postedItem.OrderDate; editedModel.Retailer = postedItem.Retailer; editedModel.RetailerPhone = postedItem.RetailerPhone; editedModel.SalesPhone = postedItem.SalesPhone; editedModel.Status = postedItem.Status; }
public ActionResult GTOrderPartialUpdate(MVC.Areas.Sell.Models.APIGTOrder item) { var model = new object[0]; if (ModelState.IsValid) { try { // Insert here a code to update the item in your model _APISalesList.UpdateItem(item); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_GTOrderPartial", _APISalesList.GetData())); }