public class OrderData
{
private static string format = "dd.MM.yyyy";
private static IsoDateTimeConverter converter = new IsoDateTimeConverter { DateTimeFormat = format };
private static string orderJson = File.ReadAllText("data/Orders.json");
private static string productJson = File.ReadAllText("data/Products.json");
private static string joiningJson = File.ReadAllText("data/OrderProducts.json");
private static List<Order> Orders = JsonConvert.DeserializeObject<List<Order>>(orderJson, converter);
private static List<Product> Products = JsonConvert.DeserializeObject<List<Product>>(productJson);
private static List<OrderProduct> Joining = JsonConvert.DeserializeObject<List<OrderProduct>>(joiningJson);
public static List<RecentOrder> RecentOrders = new List<RecentOrder> (from joining in Joining
join orders in Orders on joining.OrderID equals orders.OrderID
join products in Products on joining.ProductID equals products.ProductID
select new RecentOrder(){
ID = orders.OrderID,
Placed = orders.OrderPlaced,
Total = orders.OrderTotal,
Name = products.ProductName,
Quantity = joining.Quantity
}
);
public static List<MostOrdered> MostOrdered = {
// The part I'm trying to figure out
};
}