コード例 #1
0
ファイル: CtsService.cs プロジェクト: Egoily/LawyerSystem
        public BaseResponse UpdateCourt(UpdateCourtRequest request)
        {
            return(ServiceProcessor.ProcessRequest(request,
                                                   //inbound.do validate or do something here
                                                   () =>
            {
            },

                                                   req =>
            {
                var response = new BaseResponse();
                using (var repo = new NhRepository <Court>())
                {
                    var entity = repo.GetById(req.Id);
                    if (entity == null)
                    {
                        throw new EeException(ErrorCodes.NotFound, "Object is not found.");
                    }
                    entity.Name = req.Name;
                    entity.Rank = req.Rank;
                    entity.Province = req.Province;
                    entity.City = req.City;
                    entity.County = req.County;
                    entity.Address = req.Address;
                    entity.ContactNo = req.ContactNo;
                    repo.Update(entity);
                }
                return response;
            }
                                                   ));
        }
コード例 #2
0
ファイル: CtsService.cs プロジェクト: Egoily/LawyerSystem
        public BaseResponse UpdateClient(UpdateClientRequest request)
        {
            return(ServiceProcessor.ProcessRequest(request,
                                                   //inbound.do validate or do something here
                                                   () =>
            {
            },

                                                   req =>
            {
                var response = new BaseResponse();
                using (var repo = new NhRepository <Client>())
                {
                    var entity = repo.GetById(req.Id);
                    if (entity == null)
                    {
                        throw new EeException(ErrorCodes.NotFound, "Object is not found.");
                    }

                    entity.Name = req.Name;
                    //TODO:

                    repo.Update(entity);
                }
                return response;
            }
                                                   ));
        }
コード例 #3
0
ファイル: CourtTest.cs プロジェクト: Egoily/LawyerSystem
 public void UpdateTest()
 {
     using (var session = SessionManager.GetConnection())
     {
         using (var repo = new NhRepository <Court>())
         {
             var entity = repo.GetById(1);
             if (entity != null)
             {
                 entity.Name = "new-Name" + DateTime.Now;
                 repo.Update(entity);
             }
         }
     }
 }