コード例 #1
0
 // GET: WishList
 public ActionResult Index()
 {
     if (Session["has_login"] == null)
     {
         if (Session["ReturnToWishList"] == null)
         {
             Session["ReturnToWishList"] = "true";
         }
         else
         {
             Session["ReturnToWishList"] = null;
         }
         return(Redirect("/Login"));
     }
     else
     {
         Session.Remove("ReturnToWishList");
         ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
         var wish_list = memberPurchase.getWishLists(Session["mem_phone"].ToString()).Select(wish_info => new MemberWishListViewModel()
         {
             goods_id         = wish_info.goods_id,
             goods_name       = memberPurchase.getGoods(wish_info.goods_id).goods_name,
             goods_unit_price = memberPurchase.getGoods(wish_info.goods_id).goods_price,
             goods_img_path   = memberPurchase.getGoods(wish_info.goods_id).goods_img_path,
         }).ToList();
         var resView = new MemberWishListViewModel()
         {
             mem_phone  = Session["mem_phone"].ToString(),
             wish_lists = wish_list,
         };
         return(View(resView));
     }
 }
コード例 #2
0
        public ActionResult Index(int DeleteWishId)
        {
            Session.Remove("ReturnToWishList");
            string mem_phone = Session["mem_phone"].ToString();
            int    goods_id  = DeleteWishId;

            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            memberPurchase.deleteWishList(mem_phone, goods_id);
            var wish_list = memberPurchase.getWishLists(Session["mem_phone"].ToString()).Select(wish_info => new MemberWishListViewModel()
            {
                goods_id         = wish_info.goods_id,
                goods_name       = memberPurchase.getGoods(wish_info.goods_id).goods_name,
                goods_unit_price = memberPurchase.getGoods(wish_info.goods_id).goods_price,
                goods_img_path   = memberPurchase.getGoods(wish_info.goods_id).goods_img_path,
            }).ToList();
            var resView = new MemberWishListViewModel()
            {
                mem_phone  = Session["mem_phone"].ToString(),
                wish_lists = wish_list,
            };

            return(PartialView("WishListPart1", resView));
        }