public ActionResult GetUserBasketTop() { DataClasses.Order order = new DataClasses.Order(); //adamın zaten sepeti if (Session["sepet"] != null) { order = (Session["sepet"] as DataClasses.Order); } return(PartialView("_PartialUserBasketTop", order.Items.Count)); }
// 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)); }