public JsonResult CreateProductBasket(int id, int adet) { Product prod = productRepo.SelectById(id); ProductImage productImage = productImageRepo.FirstByProductId(id); BasketModel urun = new BasketModel(); urun.ProductName = prod.ProductName; urun.Piece = adet; urun.Price = prod.ProductPrice; urun.ShortDescription = prod.ProductShortDescription; urun.CargoPrice = prod.CargoPrice; urun.PhotoPath = productImage.Path; urun.ProductId = id; if (Session["sepet"] == null) { BasketRepository sepetim = new BasketRepository(); sepetim.Ekle(urun); Session["sepet"] = sepetim; } else { if (SepetteVarmi(urun.ProductId) == 1) { int idd = urun.ProductId; BasketRepository sepetim = (BasketRepository)Session["sepet"]; sepetim.urunler[idd].Piece += urun.Piece; Session["sepet"] = sepetim; } else { BasketRepository sepetim = (BasketRepository)Session["sepet"]; sepetim.Ekle(urun); Session["sepet"] = sepetim; } } return(Json(new { success = true, responseText = "Sepete eklenmiştir." }, JsonRequestBehavior.AllowGet)); }