Ejemplo n.º 1
0
        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;
            }
                                                   ));
        }
Ejemplo n.º 2
0
        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;
            }
                                                   ));
        }
Ejemplo n.º 3
0
 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);
             }
         }
     }
 }