public IHttpActionResult Delete(int id) { var majorInDb = _majorService.Get(id); if (majorInDb == null) { return(NotFound()); } try { _majorService.Remove(majorInDb); return(Ok()); } catch (ForeignKeyEntityException fke) { ModelState.AddModelError("", fke.Message); } return(BadRequest(ModelState)); }