コード例 #1
0
        public ActionResult OpenBasketPoup(int id)
        {
            AddToBasketResponse response = new AddToBasketResponse((int)CommonContant.LANGUAGEID.TR);


            var User = Service.LoginControl.ControlLogin();

            if (User == null)
            {
                // kullanıcı login değil

                response.SetErrror(CommonContant.ERROR_CODE.GOURL);
                response.GoUrl = "/Account/Login";

                return(Json(response));
            }

            return(PartialView("_PartialBasketPoup"));
        }
コード例 #2
0
        // GET: Product

        public ActionResult AddToBasket(int productID, int count, int color)
        {
            AddToBasketResponse response = new AddToBasketResponse(1);


            DataClasses.Order order = null;
            //adamın zaten sepeti
            if (Session["sepet"] != null)
            {
                order = (Session["sepet"] as DataClasses.Order);
            }
            else
            {
                order = new DataClasses.Order();
            }


            Data.Product p = new Data.Product
            {
                ID    = new Random().Next(1, 100),
                Name  = Common.RandomSfr.Generate(20),
                Price = new Random().Next(10000, 200000)
            };
            order.Items.Add(new DataClasses.OrderItem
            {
                Product = p,
                Count   = count,
                Color   = color
            });

            Session["sepet"] = order;

            response.SetErrror(CommonContant.ERROR_CODE.SUCCES);
            response.Count = order.Items.Sum(t => t.Count);
            return(Json(response));
        }