using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MvcAvecTests.Models {
	public class Article {
		public int Id { get; set; }
		public string Nom { get; set; }
		public double Prix { get; set; }
		public int Quantite { get; set; }
		public Article(int id, string nom, double prix, int quantite ) {
			Id = id;
			Nom = nom;
			Prix = prix;
			Quantite = quantite;
		}
		public static Dictionary<int, Article> Stock = new Dictionary<int, Article>() { { 1, new Article(1, "Un", 10, 100) }, { 2, new Article( 2, "Deux", 200, 200 ) }, { 3, new Article( 3, "Trois", 3000, 300 ) }, { 4, new Article( 4, "Quatre", 40000, 400 ) } };
		public static Dictionary<int, Article> Caddie {
			get {
				var caddie = (Dictionary < int, Article> )HttpContext.Current.Session["Caddie"];
				if( caddie == null )
					HttpContext.Current.Session["Caddie"] = caddie = new Dictionary<int, Article>();
				return caddie;
			}
		}
	}
}