Exemplo n.º 1
0
        public async Task <IActionResult> GetCategory(Guid id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorMessages()));
            }

            try
            {
                var response = await _foodCategorySerive.GetById(id);

                return(Ok(response));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Exemplo n.º 2
0
        public IActionResult GetById(int id)
        {
            var model = _foodCategoryService.GetById(id, out bool result, out string message);

            return(new OkObjectResult(new GenericResult(result, message, model)));
        }