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)); }
public async Task <ActionResult <CategoryDto> > GetCategory(int id) { var category = await _context.Categories.FindAsync(id); if (category == null) { return(NotFound()); } return(DtoConverter.ConvertToCategoryDto(category)); }