public IActionResult Update(int id) { DeliveryAddress address = _addressRepo.GetSingle(a => a.DeliveryAddressId == id); UpdateDeliveryAddressViewModel vm = new UpdateDeliveryAddressViewModel() { DeliveryAddress = address }; return(View(vm)); }
public IActionResult Update(UpdateDeliveryAddressViewModel vm, int id) { DeliveryAddress address = _addressRepo.GetSingle(a => a.DeliveryAddressId == id); address.Name = vm.DeliveryAddress.Name; address.StreetAddress = vm.DeliveryAddress.StreetAddress; address.City = vm.DeliveryAddress.City; address.State = vm.DeliveryAddress.State; address.Postcode = vm.DeliveryAddress.Postcode; _addressRepo.Update(address); return(RedirectToAction("Index")); }