public async Task <IReadOnlyList <Order> > GetOrdersForUserAsync(string buyerEmail) { var orderRepositoryObject = new OrderRepositoryObject { BuyerEmail = buyerEmail }; return(await _unitOfWork.Repository <Order>().GetAllAsync(orderRepositoryObject)); }
private IQueryable <Order> GetOrderQuery(OrderRepositoryObject orderRepositoryObject) { var query = _context.Orders .Include(i => i.OrderItems) .Include(d => d.DeliveryMethod) .AsQueryable(); if (!string.IsNullOrEmpty(orderRepositoryObject?.BuyerEmail)) { query.Where(e => e.BuyerEmail == orderRepositoryObject.BuyerEmail); } return(query); }