public ActionResult Update(Award role) { ApiResult <Award> apiResult; if (ModelState.IsValid) { if (role.Id > 0) { apiResult = TryExecute(() => { _awardRepository.Update(role); _unitOfWork.Commit(); return(role); }, "Award updated sucessfully"); } else { apiResult = TryExecute(() => { _awardRepository.Create(role); _unitOfWork.Commit(); return(role); }, "Award created sucessfully"); } } else { apiResult = ApiResultFromModelErrors <Award>(); } return(Json(apiResult, JsonRequestBehavior.AllowGet)); }
public void Create(AwardModel entity) { _awardRepository.Create(AwardMapper.ToEntity(entity)); }
public void Create(AwardWithoutIdModel model) { repository.Create(model); }