public async Task <IActionResult> Delete(int id)
        {
            var person = await db.People.FindAsync(id);

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

            db.People.Remove(person);
            await db.SaveChangesAsync();

            return(Ok("Deleted"));
        }
Exemple #2
0
        public async Task <IActionResult> DeletePerson(long id)
        {
            var person = await db.People.FindAsync(id);

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

            db.People.Remove(person);
            await db.SaveChangesAsync();

            return(NoContent());
        }