Beispiel #1
0
        public ActionResult <InsumoViewModel> Post(InsumoInputModel InsumoInput)
        {
            Insumo insumo   = MapearInsumo(InsumoInput);
            var    response = _service.GuardarInsumo(insumo);

            if (response.Error)
            {
                return(BadRequest(response.Mensaje));
            }
            return(Ok(response.Insumo));
        }
        public ActionResult <InsumoViewModel> Post(InsumoInputModel insumoInput)
        {
            Insumo insumo   = MapearInsumo(insumoInput);
            var    response = _service.GuardarInsumo(insumo);

            if (response.Error)
            {
                ModelState.AddModelError("Error al guardar insumo", response.Mensaje);
                var detallesproblemas = new ValidationProblemDetails(ModelState);
                detallesproblemas.Status = StatusCodes.Status500InternalServerError;
                return(BadRequest(detallesproblemas));
            }
            return(Ok(response.Insumo));
        }