public async Task <ActionResult <IEnumerable <Order> > > Get() { var userId = HttpContext.User.GetUserId(); var user = _context.Users.Find(userId); var q = await _userManager.IsInRoleAsync(user, "Admin") ? _context.Orders : _context.Orders.Where(o => o.UserId == userId); return(Ok(q.Include(o => o.User) .Include(o => o.OrderLines) .ThenInclude(l => l.OrderLineAdditions) .ThenInclude(o => o.Product) .Include(o => o.OrderLines) .ThenInclude(o => o.Product) .Select(o => _mapper.MapFromDal(o)).AsEnumerable())); }