public ActionResult Update(Referal referal) { ApiResult <Referal> apiResult; if (ModelState.IsValid) { if (referal.Id > 0) { apiResult = TryExecute(() => { _referalRepository.Update(referal); _unitOfWork.Commit(); return(referal); }, "Referal updated sucessfully"); } else { apiResult = TryExecute(() => { _referalRepository.Create(referal); _unitOfWork.Commit(); return(referal); }, "Referal created sucessfully"); } } else { apiResult = ApiResultFromModelErrors <Referal>(); } return(Json(apiResult, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(Referal referal) { if (ModelState.IsValid) { _referalRepository.Create(referal); _unitOfWork.Commit(); return(RedirectToAction("Index")); } ViewBag.JobOpeningId = new SelectList(_jobOpeningRepository.GetAll(), "Id", "Title", referal.JobOpeningId); return(View(referal)); }