public IActionResult Delete(int id) { var activityType = _activityTypeService.Get(id); if (activityType == null) { return(NotFound()); } _activityTypeService.Remove(activityType); return(NoContent()); }
public IHttpActionResult DeleteActivityType(int id) { var activityTypeFromDb = activityTypeService.Get(id); if (activityTypeFromDb != null) { activityTypeService.Remove(id); return(Ok()); } else { return(NotFound()); } }
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)); } }