Ejemplo n.º 1
0
        public async Task <IActionResult> DeleteStudent(int id)
        {
            var student = StudentsService.GetByID(id);

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

            try
            {
                await StudentsService.Delete(id);

                return(NoContent());
            }
            catch (DbUpdateException /* ex */)
            {
                //log the error (uncomment ex variable name and write a log.)
                return(BadRequest());
            }
        }