Exemple #1
0
        public ActionResult <Person> GetById(long id)
        {
            PersonDAO personDAO = new PersonDAO(_connection);
            var       person    = personDAO.FindByID(id);

            if (person == null)
            {
                return(NotFound());
            }

            return(person);
        }
Exemple #2
0
        public IActionResult Delete(long id)
        {
            PersonDAO personDAO = new PersonDAO(_connection);
            var       toDel     = personDAO.FindByID(id);

            if (toDel == null)
            {
                NotFound();
            }

            personDAO.Delete(toDel);
            return(NoContent());
        }
Exemple #3
0
        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());
        }