예제 #1
0
 public async Task <IEnumerable <Category> > GetCategoriesAsync()
 {
     using (var context = new WantListContext())
     {
         return(await context.Categories
                .Select(x => x)
                .ToListAsync());
     }
 }
예제 #2
0
 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());
     }
 }