Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How to query in an async method?

$
0
0

Hi,

I want to filter the database by the id:

 public async Task<IActionResult> Index(int? id)
        {
            var viewModel = new ShopIndexData()
            {
                Categories = await _context.Category
                .Include(c => c.ShopAssignments)
                .Include(s => s.ShopSortAssignment)
                .AsNoTracking()
                .ToListAsync()
            };
            return View(viewModel);

        }

How do I do that?

Poul Erik


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>