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); }
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); }
public void can_convert_from_DKK_to_USD() { var converter = new CurrencyConverter("USD"); Assert.IsTrue(14 - converter.Convert(100) < 0.0001); }
public void can_convert_from_DKK_to_EURO() { var converter = new CurrencyConverter("EURO"); Assert.IsTrue(13 - converter.Convert(100) < 0.0001); }