public IActionResult ChangeState(HourForm form) { try { hourLogic.EnableDisable(form.Id, form.IsEnabled); return(Ok()); } catch (ArgumentException ex) { return(NotFound(new { Message = ex.Message })); } catch (Exception ex) { Logger.LogError(ex, "ChangeState method"); return(NotFound(new { Message = "Ocurrió un error" })); } }
public IActionResult Create(HourForm hourForm) { try { var hour = hourLogic.Create(hourForm.Time, hourForm.DayOfWeek, hourForm.IsEnabled, hourForm.CampId); return(Ok(hour)); } catch (ArgumentException ex) { return(NotFound(new { Message = ex.Message })); } catch (Exception ex) { Logger.LogError(ex, "Create method"); return(NotFound(new { Message = "Ocurrió un error." })); } }