public ActionResult Edit(int id, CustomerModel customerToEdit) { if (!ModelState.IsValid) { return(View(customerToEdit)); } var mappedCustomer = new Customer { Id = customerToEdit.Id, Firstname = customerToEdit.Firstname, Lastname = customerToEdit.Lastname, PhoneNumber = customerToEdit.PhoneNumber, SecondPhoneNumber = customerToEdit.SecondPhoneNumber, Address = customerToEdit.Address }; _service.EditCustomer(id, mappedCustomer); return(RedirectToAction(nameof(Index))); }
private void EditCustomer(Customer customer) { customer.UpdatedAt = DateTime.Now; _customersRepository.EditCustomer(customer); }