public IActionResult Delete(int id)
        {
            var activityType = _activityTypeService.Get(id);

            if (activityType == null)
            {
                return(NotFound());
            }
            _activityTypeService.Remove(activityType);
            return(NoContent());
        }
Exemplo n.º 2
0
        public IHttpActionResult DeleteActivityType(int id)
        {
            var activityTypeFromDb = activityTypeService.Get(id);

            if (activityTypeFromDb != null)
            {
                activityTypeService.Remove(id);
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
Exemplo n.º 3
0
 public IActionResult Delete(int id)
 {
     try
     {
         var activityType = _activityTypeService.Get(id);
         _activityTypeService.Remove(activityType);
         return(NoContent());
     }
     catch (System.Exception ex)
     {
         ModelState.AddModelError("DeleteActivityType", ex.Message);
         return(BadRequest(ModelState));
     }
 }