public void UpdateFamousPeople(int id, UpdateFamousPeopleCommand command) { var person = _context.FamousPeoples.Find(id); if (person == null) { throw new Exception("Person not found"); } person.FamousPeopleId = command.FamousPeopleId; person.firstName = command.firstName; person.lastName = command.lastName; person.birthDate = command.birthDate; person.city = command.city; person.state = command.state; _context.SaveChanges(); }
public IActionResult Edit(int id, [FromBody] UpdateFamousPeopleCommand command) { _service.UpdateFamousPeople(id, command); return(Ok()); }