public async ValueTask <List <OrdersByDates> > GetSumSalesBetweenDates(DateTime startDate, DateTime endDate) { try { var result = await connection.QueryAsync <OrdersByDates, Store, Product, Category, int, decimal, OrdersByDates>( SpName.SumSalesBetweenDates, (o, s, p, c, co, ca) => { OrdersByDates order = o; o.Store = s; o.Count = co; o.Cash = ca; o.Product = p; p.Category = c; return(order); }, param : new { FromDate = startDate, ToDate = endDate }, commandType : CommandType.StoredProcedure, splitOn : "Id,Id,Id,Count,Cash"); return(result.ToList()); } catch (InvalidOperationException ex) { throw ex; } }
public async ValueTask <List <OrdersByDates> > GetOrdersByDates(DateTime FromDate, DateTime ToDate) { var result = await connection.QueryAsync <OrdersByDates, Warehouse, Goods, Category, int, decimal, OrdersByDates>( SpName.OrderByDates, (o, w, g, c, tq, tc) => { OrdersByDates order = o; o.Warehouse = w; o.TotalQuantity = tq; o.TotalCost = tc; o.Goods = g; g.Category = c; return(order); }, param : new { FromDate, ToDate }, commandType : CommandType.StoredProcedure, splitOn : "Id,Id,Id,TotalQuantity,TotalCost"); return(result.ToList()); }