Ejemplo n.º 1
0
        public ActionResult RemoveAddress(int addressid)
        {
            var address    = CustomerAddress.FromDto(_getCustomerAddress.GetCustomerAddressById(addressid));
            var customerId = address.CustomerId;

            _deleteCustomerAddress.Delete(address);

            var customerDTO = CustomerDTO.FromCustomer(_getCustomer.GetById(customerId));

            return(View("ManageAccount", customerDTO));
        }
Ejemplo n.º 2
0
        public void Save(CustomerAddressDTO address)
        {
            using (var db = new Context())
            {
                using (var transaction = db.Database.BeginTransaction())
                {
                    var addressToSave = CustomerAddress.FromDto(address);
                    db.CustomerAddress.AddOrUpdate(addressToSave);

                    db.SaveChanges();
                    transaction.Commit();
                }
            }
        }