public async Task <ActionResult> DeleteGoal(string goalId) { try { var goal = await _goalRepository.GetByIdAsync(goalId); var student = await GetStudent(goal.StudentId); await _goalRepository.DeleteAsync(goal); await RemoveGoalFromStudent(student, goalId); return(NoContent()); } catch (EntityNotFoundException) { return(NotFound(goalId)); } }
public async Task <IActionResult> DeleteAsync([FromRoute, Required] int id) { await _repo.DeleteAsync(id); return(Ok()); }