public async Task <IEnumerable <Category> > GetCategoriesAsync() { using (var context = new WantListContext()) { return(await context.Categories .Select(x => x) .ToListAsync()); } }
public async Task <Category> GetCategoryByIdAsync(int categoryId) { using (var context = new WantListContext()) { return(await context.Categories .Where(x => x.CategoryId == categoryId) .Select(x => x) .FirstOrDefaultAsync()); } }