public IActionResult OnPost(string submit) { if (submit == "Cancel") { return(RedirectToPage("Index")); } if (!ModelState.IsValid) { PayRoll = _payrollDm.PopulateSelectedList(PayRoll); return(Page()); } if (_payrollDm.BlnFindPayRollByAuthorId(int.Parse(PayRoll.AuthorTypeId))) { ModelState.AddModelError("AuthorTypeId", "Author has an existing PayRoll record."); } else { ModelState.Clear(); } if (!ModelState.IsValid) { PayRoll = _payrollDm.PopulateSelectedList(PayRoll); return(Page()); } _payrollDm.Add(PayRoll); return(RedirectToPage("Index")); }
public ActionResult Create(PayRollVM.Payroll payroll, string submit) { if (submit == "Cancel") { return(RedirectToAction("Index")); } if (!ModelState.IsValid) { return(View(pdm.PopulateSelectedList(payroll))); } if (pdm.BlnFindPayRollByAuthorId(int.Parse(payroll.AuthorTypeId))) { ModelState.AddModelError(string.Empty, "Author has an existing PayRoll record."); } if (!ModelState.IsValid) { return(View(pdm.PopulateSelectedList(payroll))); } pdm.Add(payroll); return(RedirectToAction("Index")); }
public ActionResult Edit(PayRollVM.Payroll payroll, string submit) { if (submit == "Cancel") { return(RedirectToAction("Index")); } if (!ModelState.IsValid) { return(View(payroll)); } pdm.Update(payroll); return(RedirectToAction("Index")); }
public IActionResult OnGet(int id) { PayRoll = _payrollDm.Find(id); return(Page()); }
public IActionResult OnGet() { PayRoll = _payrollDm.Add(); return(Page()); }