public static void AddItem(APIInvoiceType postedItem) { List <APIInvoiceType> list = GetData(); //postedItem.Code = String.Format("IT-{0:yyyyMMddHHmmssfff}", DateTime.Now); list.Add(postedItem); }
public static void UpdateItem(APIInvoiceType postedItem) { var editedModel = GetData().First(i => i.Code == postedItem.Code); editedModel.Name = postedItem.Name; editedModel.Description = postedItem.Description; editedModel.Type = postedItem.Type; }
public ActionResult InvoiceTypeGridViewPartialUpdate(MVC.Areas.Accounting.Models.Configuration.APIInvoiceType item) { var model = InvoiceTypeList.GetData(); if (ModelState.IsValid) { try { InvoiceTypeList.UpdateItem(item); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_InvoiceTypeGridViewPartial", model)); }