public ActionResult CreateStaff(Staff staff) { if (ModelState.IsValid) { _repositoryStaff = new RepositoryStaff(); var ops = _repositoryStaff.saveStaff(staff); if (ops.Status) { return(RedirectToAction("ProjectList", "Project")); } else { ModelState.AddModelError("", ops.ExceptionInnerMessage); } } return(View()); }
public JsonResult AddStaffAsync(string staffname, string staffdescription) { _repositoryStaff = new RepositoryStaff(); Staff addstaff = new Staff(); addstaff.StaffName = staffname; addstaff.StaffPosition = staffdescription; OperationStatus ops = _repositoryStaff.saveStaff(addstaff); if (ops.Status) { return(Json(new { StaffId = addstaff.StaffId, StaffName = addstaff.StaffName }, JsonRequestBehavior.AllowGet)); } else { return(Json(new ArgumentException(ops.ExceptionInnerMessage), JsonRequestBehavior.AllowGet)); } }