public ActionResult Create(ActionDTO action) { MethodBase method = MethodBase.GetCurrentMethod(); try { Action newAction = Mapper.Map <Action>(action); newAction.IsValid = true; newAction.Id = 0; var response = ActionRepo.Create(newAction); if (response > 0) { CreateLog(Enums.Success, GetMethodCode(method), LogLevel.Information); return(Ok(response)); } else { CreateLog(Enums.BadRequest, GetMethodCode(method), LogLevel.Warning); return(BadRequest(response)); } } catch (Exception ex) { return(HandleError(ex.Message, GetMethodCode(method))); } }
public ActionResult Delete(ActionDTO action) { MethodBase method = MethodBase.GetCurrentMethod(); try { if (action.Id > 0) { Action delAction = Mapper.Map <Action>(action); ActionRepo.Delete(delAction); CreateLog(Enums.Success, GetMethodCode(method), LogLevel.Information); return(Ok(true)); } else { CreateLog(Enums.BadRequest, GetMethodCode(method), LogLevel.Information); return(BadRequest()); } } catch (Exception ex) { return(HandleError(ex.Message, GetMethodCode(method))); } }