Example #1
0
        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));
        }
Example #2
0
 public void Remove(Guid id)
 {
     courseTypeService.Remove(id);
     unitOfWork.Commit();
 }