public ActionResult Update(CandidateDesignation candidateDesignation) { ApiResult <CandidateDesignation> apiResult; if (ModelState.IsValid) { if (candidateDesignation.Id > 0) { apiResult = TryExecute(() => { _candidateDesignationRepository.Update(candidateDesignation); _unitOfWork.Commit(); return(candidateDesignation); }, "Candidate Designation updated sucessfully"); } else { apiResult = TryExecute(() => { _candidateDesignationRepository.Create(candidateDesignation); _unitOfWork.Commit(); return(candidateDesignation); }, "Candidate Designation created sucessfully"); } } else { apiResult = ApiResultFromModelErrors <CandidateDesignation>(); } return(Json(apiResult, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(CandidateDesignation candidateDesignation) { if (ModelState.IsValid) { _candidateDesignationRepository.Create(candidateDesignation); _unitOfWork.Commit(); return(RedirectToAction("Index")); } return(View(candidateDesignation)); }