コード例 #1
0
 public ActionResult shoppingCart(int?id, string movieName, string playTime, string cinemaName, decimal?movieTotalPrice, string seats, string area)
 {
     if (id == null || String.IsNullOrEmpty(movieName) || String.IsNullOrEmpty(playTime) || String.IsNullOrEmpty(cinemaName) || movieTotalPrice == null || String.IsNullOrEmpty(seats) || String.IsNullOrEmpty(area))
     {
         buyInfoList         = new List <buyInfo>(orders.Values);
         ViewBag.buyInfoList = buyInfoList;
         return(View());
     }
     else
     {
         buyInfo buy = new buyInfo(id, movieName, playTime, cinemaName, movieTotalPrice, seats, area);
         buy.thisID = ((id.GetHashCode() + cinemaName.GetHashCode() + seats.GetHashCode()) < 0? (id.GetHashCode() + cinemaName.GetHashCode() + seats.GetHashCode()) * -1 / 10000: (id.GetHashCode() + cinemaName.GetHashCode() + seats.GetHashCode()) / 10000).ToString();
         orders.Add(buy.thisID, buy);
         buyInfoList         = new List <buyInfo>(orders.Values);
         ViewBag.buyInfoList = buyInfoList;
         return(View());
     }
 }
コード例 #2
0
        public ActionResult pay(int?id, string movieName, string playTime, string cinemaName, decimal?movieTotalPrice, string seats, string area)
        {
            if (id == null || String.IsNullOrEmpty(movieName) || String.IsNullOrEmpty(playTime) || String.IsNullOrEmpty(cinemaName) || movieTotalPrice == null || String.IsNullOrEmpty(seats) || String.IsNullOrEmpty(area))
            {
                Index(null, null, null);
                return(View("Index"));
            }
            else
            {
                buyInfo buy = new buyInfo(id, movieName, playTime, cinemaName, movieTotalPrice, seats, area);
                ViewBag.buyInfo = buy;

                var movieByID = from m in db.Movies
                                where m.id == id
                                select m;

                return(View(movieByID));
            }
        }