public async Task <IActionResult> GetCategory(int id)
        {
            var logicValidation = new LogicValidations();

            var categoryFromDatabase = await _DominiRepository.GetClientCategory(id);

            if (logicValidation.IsNotNull(categoryFromDatabase))
            {
                var categoryDTO = new CategoriesDTO(categoryFromDatabase);
                return(Ok(categoryDTO));
            }
            else
            {
                return(NotFound());
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetCategory(int id)
        {
            ClientCategory categoryFromDatabase = await _bdRepository.GetClientCategory(id);

            if (logicValidations.ValidateIfDataIsNotNull(categoryFromDatabase))
            {
                CategoriesDTO categoryDTO = new CategoriesDTO()
                {
                    CategoryId   = categoryFromDatabase.CategoryId,
                    CategoryName = categoryFromDatabase.CategoryName,
                    Active       = categoryFromDatabase.Active
                };
                return(Ok(categoryDTO));
            }
            return(NotFound());
        }