コード例 #1
0
        public ActionResult <InsumoViewModel> Get()
        {
            var response = _service.ConsultarInsumos();

            if (response.Error)
            {
                return(BadRequest(response.Mensaje));
            }
            return(Ok(response.Insumos.Select(a => new InsumoViewModel(a))));
        }
コード例 #2
0
        public ActionResult <AsignaturaViewModel> Get()
        {
            var response = _service.ConsultarInsumos();

            if (response.Error)
            {
                ModelState.AddModelError("Error al consultar insumo", response.Mensaje);
                var detallesproblemas = new ValidationProblemDetails(ModelState);
                detallesproblemas.Status = StatusCodes.Status500InternalServerError;
                return(BadRequest(detallesproblemas));
            }
            return(Ok(response.Insumos.Select(a => new InsumoViewModel(a))));
        }