public Customer Update(string customerId, CustomerUpdateCmd command) { // 1 buscamos al elemento en la lista var customerInDataBase = Find(customerId); customerInDataBase.FirstName = command.FirstName; customerInDataBase.LastName = command.LastName; return(customerInDataBase); }
public Customer Update(string customerId, CustomerUpdateCmd command) { var customer = _customerRepository.Find(customerId); if (customer == null) { throw new NotFoundException(); } return(_customerRepository.Update(customerId, command)); }
public IActionResult UpdateCustomer([FromRoute] string customerId, CustomerUpdateCmd command) { try { var customer = _customerService.Update(customerId, command); return(Ok(customer)); } catch (NotFoundException ex) { return(NotFound()); } catch (Exception ex) { return(BadRequest()); } }