Exemplo n.º 1
0
        /// <summary>
        /// This function manage data from service to repository pattern.
        /// There is also called creation of Billing info.
        /// </summary>
        /// <param name="item">Inserted object</param>
        /// <returns>Pre-mapped object</returns>
        public Customer Create(CustomerDTO item)
        {
            var billingInfo = _billingInfoFactory.Create(item.BillingInfo);

            item.BillingInfo = _mapper.Map <BillingInfoDTO>(billingInfo);
            _repository.Add(item);
            _repository.Save();

            return(_mapper.Map <Customer>(item));
        }
Exemplo n.º 2
0
        public BillingInfo Add(BillingInfo item)
        {
            try
            {
                var billingInfo = _mapper.Map <BillingInfoDTO>(item);
                var result      = _factory.Create(billingInfo);
                return(result);
            }
            catch (Exception e)
            {
                _logger.LogError($"There is a problem with save Address : {e}");
            }

            return(null);
        }