public JsonResult SepeteEkle(long Id) { Kullanici klnc = Session["giris"] as Kullanici; if (klnc != null) { int sayi = 0; UrunYonetici uy = new UrunYonetici(); SepetYonetici sy = new SepetYonetici(); List<Sepet> sptler = sy.List(x=>x.kullaniciId==klnc.kullaniciId); Urun urn = uy.Find(x => x.ilanId == Id); for (int i = 0; i < sptler.Count; i++) { if (sptler[i].urunId == urn.urunId) sayi++; } if (sayi == 0) { Sepet spt = new Sepet(); spt.urunId = urn.urunId; spt.kullaniciId = App.Common.GetCurrentUsernameId(); sy.Insert(spt); } } return Json("dENEME"); }
public JsonResult SepetleriSil() { Kullanici klnc = Session["giris"] as Kullanici; SepetYonetici sy = new SepetYonetici(); if (klnc != null) { List<Sepet> sptler = sy.List(x => x.kullaniciId == klnc.kullaniciId); for (int i = 0; i < sptler.Count; i++) { if (sptler[i].faturaId == null) { sy.Delete(sptler[i]); } } } return Json("deneme1"); }
public JsonResult SepetSil(long Id) { Kullanici klnc = Session["giris"] as Kullanici; if (klnc != null) { int sayi = 0; UrunYonetici uy = new UrunYonetici(); SepetYonetici sy = new SepetYonetici(); List<Sepet> sptler = sy.List(x => x.kullaniciId == klnc.kullaniciId); Urun urn = uy.Find(x => x.ilanId == Id); for (int i = 0; i < sptler.Count; i++) { if (sptler[i].urunId == urn.urunId) sayi++; } if (sayi != 0) { Sepet spt = sy.Find(x => x.urunId == urn.urunId); sy.Delete(spt); } } return Json("deneme1"); }