public async Task <IActionResult> Delete(int?id) { if (id == null) { return(BadRequest()); } POJO model = await _Student.DeleteAsync(id); if (model == null) { return(NotFound()); } return(Ok(model)); }
public async Task <IActionResult> DeleteStudent([FromRoute] int studentId) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Student student = await _studentService.GetByIdAsync(studentId); CapstoneUser user = student.User; if (student == null) { return(BadRequest("Student not found")); } await _studentService.DeleteAsync(student); await _userManager.DeleteAsync(user); return(Ok()); }