public ActionResult Index(int id)
 {
     var currencyConverter = new CurrencyConverter(Session["Currency"].ToString());
     var movie = facade.GetMovieGateway().ReadById(id);
     movie.Price = currencyConverter.Convert(movie.Price);
     return View(movie);
 }
示例#2
0
        public ActionResult Cart()
        {
            //if (Session["Cart"] == null)
            //{
            //    Session["Cart"] = new List<Movie>();
            //}

            //var movies = ((List<Movie>) Session["Cart"]);
            //var currencyConverter = new CurrencyConverter(Session["Currency"].ToString());
            //foreach (var movie in movies)
            //{
            //    movie.Price = currencyConverter.Convert(movie.Price);
            //}
            //return PartialView(movies);

            if (Session["Cart"] == null)
            {
                Session["Cart"] = new List<Movie>();
            }

            var movies = new List<Movie>();
            var currencyConverter = new CurrencyConverter(Session["Currency"].ToString());
            foreach (var movie in ((List<Movie>)Session["Cart"]))
            {
                movies.Add(new Movie()
                {
                    Title = movie.Title,
                    Price = currencyConverter.Convert(movie.Price),
                    PicturePath = movie.PicturePath
                });
            }
            return PartialView(movies);
        }
示例#3
0
 public void can_convert_from_DKK_to_USD()
 {
     var converter = new CurrencyConverter("USD");
     Assert.IsTrue(14 - converter.Convert(100) < 0.0001);
 }
示例#4
0
 public void can_convert_from_DKK_to_EURO()
 {
     var converter = new CurrencyConverter("EURO");
     Assert.IsTrue(13 - converter.Convert(100) < 0.0001);
 }
示例#5
0
        public ActionResult CurrencyDropDown()
        {
            var converter = new CurrencyConverter(Session["Currency"].ToString());

            return PartialView(converter.Currencies);
        }