public ActionResult <Person> GetById(long id) { PersonDAO personDAO = new PersonDAO(_connection); var person = personDAO.FindByID(id); if (person == null) { return(NotFound()); } return(person); }
public IActionResult Delete(long id) { PersonDAO personDAO = new PersonDAO(_connection); var toDel = personDAO.FindByID(id); if (toDel == null) { NotFound(); } personDAO.Delete(toDel); return(NoContent()); }
public IActionResult Update(long id, Person person) { PersonDAO personDAO = new PersonDAO(_connection); var pOld = personDAO.FindByID(id); if (pOld == null) { return(NotFound()); } pOld.FirstName = person.FirstName; pOld.LastName = person.LastName; pOld.Email = person.Email; personDAO.Update(pOld); return(NoContent()); }