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)); }
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(); } } }