public Task Get(int id){ var task = _taskRepository.Get(id); if (task == null) { throw new HttpResponseException(new HttpResponseMessage { StatusCode = HttpStatusCode.NotFound, Content = new StringContent("Task not found") }); } return task;}
public Task Put(Task task){ try { task = _taskRepository.Put(task); } catch (Exception) { throw new HttpResponseException(new HttpResponseMessage { StatusCode = HttpStatusCode.NotFound, Content = new StringContent("Task not found") }); } return task;}
//HttpStatusCode.NotFound (404)