コード例 #1
0
        public BankAccountTypeDTO updateBankAccountType(BankAccountTypeDTO bankAccountType)
        {
            var selectedBankAccountType = uow.GetRepository <BankAccountType>().Get(z => z.Id == bankAccountType.Id);

            selectedBankAccountType = MapperFactory.CurrentMapper.Map(bankAccountType, selectedBankAccountType);
            uow.GetRepository <BankAccountType>().Update(selectedBankAccountType);
            uow.SaveChanges();
            return(MapperFactory.CurrentMapper.Map <BankAccountTypeDTO>(selectedBankAccountType));
        }
コード例 #2
0
        public HttpResponseMessage Get(int Id)
        {
            BankAccountTypeDTO selectedTitle = service.getBankAccountType(Id);

            if (selectedTitle == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Id + sysLanguage.CompanyTitlesControllerStrings.id_title));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, selectedTitle));
        }
コード例 #3
0
        public HttpResponseMessage Put(BankAccountTypeDTO bankAccountTypeDTO)
        {
            BankAccountTypeDTO dto = service.updateBankAccountType(bankAccountTypeDTO);

            if (dto != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, dto));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.update_title));
            }
        }
コード例 #4
0
 public BankAccountTypeDTO newBankAccountType(BankAccountTypeDTO bankAccountType)
 {
     if (!uow.GetRepository <BankAccountType>().GetAll().Any(z => z.Id == bankAccountType.Id))
     {
         var adedBankAccountType = MapperFactory.CurrentMapper.Map <BankAccountType>(bankAccountType);
         adedBankAccountType = uow.GetRepository <BankAccountType>().Add(adedBankAccountType);
         uow.SaveChanges();
         return(MapperFactory.CurrentMapper.Map <BankAccountTypeDTO>(adedBankAccountType));
     }
     else
     {
         return(null);
     }
 }
コード例 #5
0
        public HttpResponseMessage Post(BankAccountTypeDTO bankAccountTypeDTO)
        {
            BankAccountTypeDTO dto = service.newBankAccountType(bankAccountTypeDTO);

            if (dto != null)
            {
                HttpResponseMessage message = Request.CreateResponse(HttpStatusCode.Created, dto);
                message.Headers.Location = new Uri(Request.RequestUri + "/" + dto.Id);
                return(message);
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.add_title));
            }
        }