private dynamic GetOrderDynamic(OrdersDynamicModel table, int id) { return(table.Query(@"SELECT [WorkOrderID] AS Id, P.Name AS ProductName, [OrderQty] AS Quantity, [DueDate] AS Date FROM [AdventureWorks2014].[Production].[WorkOrder] AS WO INNER JOIN[Production].[Product] AS P ON P.ProductID = WO.ProductID WHERE WorkOrderID = @0", id).FirstOrDefault()); }
//1 itération public List <dynamic> GetOrdersDynamic() { var table = new OrdersDynamicModel(); return(table.Query(@"SELECT TOP 500 [WorkOrderID] AS Id, P.Name AS ProductName, [OrderQty] AS Quantity, [DueDate] AS Date FROM [AdventureWorks2014].[Production].[WorkOrder] AS WO INNER JOIN[Production].[Product] AS P ON P.ProductID = WO.ProductID").ToList()); }
private OrdersDynamicModel GetOrder(OrdersDynamicModel table, int id) { var order = GetOrderDynamic(table, id); return(new OrdersDynamicModel { Id = order.Id, ProductName = order.ProductName, Quantity = order.Quantity, Date = order.Date }); }
public List <OrdersDynamicModel> GetOrders(int iteration) { var listOrders = new List <OrdersDynamicModel>(); var table = new OrdersDynamicModel(); for (int i = 1; i <= iteration; i++) { listOrders.Add(GetOrder(table, i)); } return(listOrders); }