Пример #1
0
        public async Task <bool> updateCustomer(GetCustomerDto getCustomerDto)
        {
            try
            {
                Customer oCustomer = await _Customers.SingleAsync(i => i.id == getCustomerDto.id);

                oCustomer.address       = getCustomerDto.address;
                oCustomer.countryId     = getCustomerDto.countryId;
                oCustomer.email1        = getCustomerDto.email1;
                oCustomer.email2        = getCustomerDto.email2;
                oCustomer.email3        = getCustomerDto.email3;
                oCustomer.fax           = getCustomerDto.fax;
                oCustomer.fullName      = getCustomerDto.fullName;
                oCustomer.IdentityNo    = getCustomerDto.IdentityNo;
                oCustomer.isActive      = getCustomerDto.isActive;
                oCustomer.isReal        = getCustomerDto.isReal;
                oCustomer.mobile        = getCustomerDto.mobile;
                oCustomer.modiferUserId = getCustomerDto.userId;
                oCustomer.telephone     = getCustomerDto.telephone;
                oCustomer.webSite       = getCustomerDto.webSite;
                oCustomer.isConsignee   = getCustomerDto.isConsignee;
                oCustomer.isNotify      = getCustomerDto.isNotify;
                oCustomer.isShipper     = getCustomerDto.isShipper;

                await _uow.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// get customer detail from stripe
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public async Task <CustomerDto> GetCustomer(GetCustomerDto dto)
        {
            var service = new CustomerService();

            return(CustomerMapper.MapCustomerToCustomerDto(
                       await service.GetAsync(dto.CustomerId)));
        }
Пример #3
0
        public async Task <GetCustomerDto> getCustomerInitial()
        {
            GetCustomerDto oGetCustomerDto = new GetCustomerDto();

            oGetCustomerDto.countries = await _CountryService.getCountriesDdlDto();

            return(oGetCustomerDto);
        }
Пример #4
0
        public async Task <GetCustomerDto> getCustomer(BaseDto baseDto)
        {
            GetCustomerDto oGetCustomerDto = Mapper.Map <Customer, GetCustomerDto>(await _Customers.AsNoTracking().SingleOrDefaultAsync(i => i.id == baseDto.id));

            oGetCustomerDto.countries = await _CountryService.getCountriesDdlDto();

            return(oGetCustomerDto);
        }
Пример #5
0
 public async Task <HttpResponseMessage> updateCustomer(GetCustomerDto CustomerDto)
 {
     CustomerDto.userId = Setting.payloadDto.userId;
     if (await _CustomerService.updateCustomer(CustomerDto))
     {
         return(new HttpResponseMessage(HttpStatusCode.OK));
     }
     else
     {
         return(new HttpResponseMessage(HttpStatusCode.NotModified));
     }
 }
Пример #6
0
 public async Task <HttpResponseMessage> insertCustomer(GetCustomerDto CustomerDto)
 {
     CustomerDto.userId = Setting.payloadDto.userId;
     if (await _CustomerService.insertCustomer(CustomerDto))
     {
         return(Request.CreateResponse(HttpStatusCode.Created));
     }
     else
     {
         return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
     }
 }
Пример #7
0
        public async Task <GetCustomerDto> getCustomer(int id)
        {
            GetCustomerDto oGetCustomerDto = await _CustomerService.getCustomer(new BaseDto { id = id });

            if (oGetCustomerDto == null)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
            }
            else
            {
                return(oGetCustomerDto);
            }
        }
Пример #8
0
        public async Task <bool> insertCustomer(GetCustomerDto getCustomerDto)
        {
            try
            {
                Customer oCustomer = Mapper.Map <GetCustomerDto, Customer>(getCustomerDto);
                _Customers.Add(oCustomer);
                await _uow.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }