public async Task <CustomerHeadDto> GetCustomerByCustomerIdAsync(int customerId)
        {
            var customerInfo = await _customerService.GetCustomerByCustomerIdAsync(customerId);

            var zone = await _zoneService.GetZoneByBranchIDAsync(customerInfo.BranchID);

            //  CustomerHeadDto result = new CustomerHeadDto();
            var result = _mapper.Map <CustomerHeadDto>(customerInfo);

            result.Zone            = _mapper.Map <ZoneDto>(zone);
            result.CustomerDetails = new List <CustomerDetailDto>();
            result.BranchName      = _branchService.GetBranchByBranchCodeAsync(customerInfo.BranchCode).Result.BranchName;


            customerInfo.CustomerDetails.ForEach(x =>
            {
                result.CustomerDetails.Add(new CustomerDetailDto()
                {
                    Code  = x.CustomerDetailType.Code,
                    Value = x.Value,
                    ID    = x.ID
                });
            });
            return(result);
        }
Exemple #2
0
        public async Task <BranchDto> GetBranchByBranchCodeAsync(string branchCode)
        {
            var mybranch = await _branchService.GetBranchByBranchCodeAsync(branchCode);

            var branchDto = _mapper.Map <BranchDto>(mybranch);

            return(branchDto);
        }