Ejemplo n.º 1
0
 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" }));
     }
 }
Ejemplo n.º 2
0
 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." }));
     }
 }