public void AddItem(APIMTOrderItem postedItem) { List <APIMTOrderItem> list = GetData(); postedItem.Code = (list.Count + 1); list.Add(postedItem); }
public void UpdateItem(APIMTOrderItem postedItem) { var editedModel = GetData().First(i => i.Code == postedItem.Code); editedModel.NO = postedItem.NO; editedModel.Code = postedItem.Code; editedModel.Name = postedItem.Name; editedModel.Specification = postedItem.Specification; editedModel.UoM = postedItem.UoM; editedModel.QuantityInUoM = postedItem.QuantityInUoM; editedModel.Quantity = postedItem.Quantity; editedModel.Price = postedItem.Price; editedModel.Percentage = postedItem.Percentage; editedModel.Amount = postedItem.Amount; }
public ActionResult MTOrderItemPartialUpdate(MVC.Areas.Sell.Models.APIMTOrderItem item) { var model = new object[0]; if (ModelState.IsValid) { try { // Insert here a code to update the item in your model _MTOrderItem.UpdateItem(item); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_MTOrderItemPartial", _MTOrderItem.GetData())); }