Beispiel #1
0
        public async Task <ActionResult <CategoryDto> > GetCategory(int id)
        {
            Product product = await _context.Products.FindAsync(id);

            if (product == null)
            {
                return(NotFound());
            }

            return(DtoConverter.ConvertToCategoryDto(product.Category));
        }
Beispiel #2
0
        public async Task <ActionResult <CategoryDto> > GetCategory(int id)
        {
            var category = await _context.Categories.FindAsync(id);

            if (category == null)
            {
                return(NotFound());
            }

            return(DtoConverter.ConvertToCategoryDto(category));
        }