public ActionResult Create(SalaryPayslip model, List <SalaryPayslipDetail> details) { try { // TODO: Add insert logic here var result = new ResultModel(); //var model = new Reimbursement(); if (model != null) { model.CreatedAt = DateTime.Now; model.CreatedBy = SessionItems.CurrentUser.UserID; result = model.Insert(); } if (result.BooleanResult) { foreach (var obj in details) { obj.Insert(); } } else { //Bad result result.StringResult += "Save Error"; return(new JsonResult() { Data = result }); } return(new JsonResult() { Data = result }); } catch { return(new JsonResult() { Data = ResultModel.FailResult() }); } }
public ActionResult Edit(SalaryPayslip model, List <SalaryPayslipDetail> details) { try { var result = new ResultModel(); if (model.id > 0) { result = model.SaveOrUpDate(); } if (result.BooleanResult) { foreach (var obj in details) { if (obj.id > 0) { obj.SaveOrUpDate(); } else { obj.Insert(); } } } return(new JsonResult() { Data = result }); } catch { return(new JsonResult() { Data = ResultModel.FailResult() }); } }
// GET: SalaryPayslip/Edit/5 public ActionResult Edit(int id) { return(View(SalaryPayslip.GetById(id))); }
// GET: SalaryPayslip public ActionResult Index() { return(View(SalaryPayslip.GetAll())); }