コード例 #1
0
ファイル: AwardsController.cs プロジェクト: xprasoulas/grid
        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));
        }
コード例 #2
0
 public void Create(AwardModel entity)
 {
     _awardRepository.Create(AwardMapper.ToEntity(entity));
 }
コード例 #3
0
 public void Create(AwardWithoutIdModel model)
 {
     repository.Create(model);
 }