public void DeleteCourse(int ID) { bool deleteSuccessful = _service.DeleteCourse(ID); if (!deleteSuccessful) { throw new HttpResponseException(HttpStatusCode.NotFound); } }
public void DeleteCourse(int ID) { try { _service.DeleteCourse(ID); } catch (AppObjectNotFoundException) { throw new HttpResponseException(HttpStatusCode.NotFound); } }
public void DeleteCourse(int id) { try { _service.DeleteCourse(id); // this may throw a not found exception } catch (CourseNotFoundException) { throw new HttpResponseException(HttpStatusCode.NotFound); } catch (DeleteFromDatabaseException) { throw new HttpResponseException(HttpStatusCode.InternalServerError); } }