public IHttpActionResult Delete(int id) { var courseTypeInDb = _courseTypeService.Get(id); if (courseTypeInDb == null) { return(NotFound()); } try { _courseTypeService.Remove(courseTypeInDb); return(Ok()); } catch (ArgumentNullException ane) { ModelState.AddModelError("", ane.Message); } catch (ForeignKeyEntityException fke) { ModelState.AddModelError("", fke.Message); } return(BadRequest(ModelState)); }
public void Remove(Guid id) { courseTypeService.Remove(id); unitOfWork.Commit(); }