Example #1
0
        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));
        }
Example #2
0
 public void Create(AwardModel entity)
 {
     _awardRepository.Create(AwardMapper.ToEntity(entity));
 }
Example #3
0
 public void Create(AwardWithoutIdModel model)
 {
     repository.Create(model);
 }