示例#1
0
        public IActionResult UpdateCustomer([FromBody] Bukimedia.PrestaSharp.Entities.customer customer)
        {
            var musteri = _customerfactory.Get((long)customer.id);

            _customerfactory.Update(customer);
            return(Ok(customer));
        }
 public IActionResult UpdateCustomer([FromBody] Bukimedia.PrestaSharp.Entities.customer customer)
 {
     try
     {
         var musteri = _customerFactory.Get((long)customer.id);
         _customerFactory.Update(customer);
         return(Ok(customer));
     }
     catch (Exception)
     {
         return(NotFound());
     }
 }
 public IActionResult Customers([FromBody] Bukimedia.PrestaSharp.Entities.customer customer)
 {
     try
     {
         // minumum requirement saglanmiyorsa catch'e dusecek
         // daha once ayni id'ye sahip satir var mi diye bakmiyoruz cunku db zaten id'yi otomatik atiyor
         _customerFactory.Add(customer);
     }
     catch (Exception exception)
     {
         return(BadRequest());
     }
     return(Ok());
 }
示例#4
0
        private PsAddress InsertAddress(PsCustomer psCustomer, AddressEntity address, string alias)
        {
            var psAddress = new PsAddress();

            psAddress.id_customer = psCustomer.id;
            psAddress.alias       = alias;

            var country = prestaShopClient.DefaultCountry;

            psAddress.id_country = country.id;

            UpdateAddress(address, psAddress);

            return(psAddress);
        }
示例#5
0
        private void SynchronizeAddresses(CustomerEntity customer, PsCustomer psCustomer)
        {
            var address = customer.GetMainAddress();

            if (address != null && address.IsValid)
            {
                var psAddress = GetPsAddress(address.WebId);

                if (psAddress == null && address.WebId.HasValue)
                {
                    address.WebId = null;
                }

                if (psAddress == null)
                {
                    if (!address.IsArchived)
                    {
                        psAddress = InsertAddress(psCustomer, address, "Domyślny");
                    }
                }
                else
                {
                    if (address.IsArchived)
                    {
                        DeleteAddress(address, psAddress);
                    }
                    else
                    {
                        UpdateAddress(address, psAddress);
                    }
                }

                if (psAddress != null)
                {
                    psAddress = SaveOrUpdateAddress(address, psAddress);
                }

                if (!address.WebId.HasValue)
                {
                    address.WebId = (int?)psAddress?.id;
                }

                address.Synchronize = Framework.SynchronizeType.Synchronized;
            }
        }
 private CustomerEntity InsertPsCustomer(PsCustomer psCustomer)
 {
     throw new NotImplementedException();
 }
 private void UpdatePsCustomer(CustomerEntity order, PsCustomer psCustomer)
 {
     throw new NotImplementedException();
 }
示例#8
0
 public IActionResult AddCustomer([FromBody] Bukimedia.PrestaSharp.Entities.customer customer) //hazır model
 {
     _customerfactory.Add(customer);
     return(Ok(customer));
 }