public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here var model = ExtraPayrollItems.GetById(id); TryUpdateModel(model); model.SaveOrUpDate(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here var model = new ExtraPayrollItems(); TryUpdateModel(model); model.Insert(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult SaveExtraItems(List <ExtraPayrollItems> objs) { if (objs != null && objs.Count > 0) { //delete all var all = ExtraPayrollItems.GetAll(); if (all != null && all.Count > 0) { foreach (var obj in all) { obj.Delete(); } } //add them back foreach (var obj in objs.Where(x => x.Amount > 0 && !string.IsNullOrEmpty(x.PayrollItemName)).ToList()) { obj.Insert(); } } return(new JsonResult() { Data = ResultModel.SuccessResult() }); }
// GET: ExtraPayrollItems/Edit/5 public ActionResult Edit(int id) { return(View(ExtraPayrollItems.GetById(id))); }
// GET: ExtraPayrollItems public ActionResult Index() { return(PartialView(ExtraPayrollItems.GetAll())); }