using System; using System.Collections.Generic; using System.Linq; using System.Web; using HeuristicLab.Services.Optimization.Billing.Model; namespace HeuristicLab.Services.Optimization.Web.Models { public class OrderModel { public string BillingType { get; set; } public string BillingPeriod { get; set; } public DateTime ActiveSince { get; set; } public DateTime ActiveUntil { get; set; } // product id to quantity mapping public IDictionary ProductQuantities { get; set; } public IDictionary Products { get; set; } public double TotalSum() { double sum = 0; foreach (var key in ProductQuantities.Keys) { sum += ProductQuantities[key] * Products[key].Price; } return sum; } public double ProductSum(long productId) { return Products[productId].Price * ProductQuantities[productId]; } public OrderModel() { ProductQuantities = new Dictionary(); Products = new Dictionary(); } } public class ProductsModel { public IList Products { get; set; } public int Quantity { get; set; } public long ProductId { get; set; } } }