示例#1
0
 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());
     }
 }
示例#2
0
 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());
     }
 }
示例#3
0
 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()
     });
 }
示例#4
0
 // GET: ExtraPayrollItems/Edit/5
 public ActionResult Edit(int id)
 {
     return(View(ExtraPayrollItems.GetById(id)));
 }
示例#5
0
 // GET: ExtraPayrollItems
 public ActionResult Index()
 {
     return(PartialView(ExtraPayrollItems.GetAll()));
 }