public ActionResult <PanelaViewModel> Post(PanelaInputModel panelaInput) { Panela panela = MapearPanela(panelaInput); var response = _panelaService.Guardar(panela); if (response.Error) { return(BadRequest(response.Mensaje)); } return(Ok(response.Panela)); }
public ActionResult <PanelaViewModel> Post(PanelaInputModel panelaInput) { Panela panela = MapearPanela(panelaInput); var response = _panelaService.Guardar(panela); if (response.Error) { ModelState.AddModelError("Guardar Panela", response.Mensaje); var problemDetails = new ValidationProblemDetails(ModelState) { Status = StatusCodes.Status400BadRequest, }; return(BadRequest(problemDetails)); } return(Ok(response.Panela)); }