//------------------------------------------------------------------------------------------------------------------------------------------+ public void SepetiVeritabanındaGüncelle(string sepetId, SepetGüncelleme[] sepetItemsUpdates) { var sepetItems = _uow.UrunSepetRepository.Get(x => x.SepetId == sepetId); foreach (UrunSepet oldItem in sepetItems) { SepetGüncelleme guncelItem = sepetItemsUpdates.FirstOrDefault(x => x.UrunId == oldItem.UrunId); if (guncelItem.AlimMiktari < 1 || guncelItem.UrunCikar == true) { ÜrünÇıkar(sepetId, oldItem.UrunId); } else { ÜrünGüncelle(sepetId, oldItem.UrunId, guncelItem.AlimMiktari); } } }
protected void UpdateBtn_Click(object sender, ImageClickEventArgs e) { Sepetim usersShoppingCart = new Sepetim(); string sepetID = usersShoppingCart.SepetIdAl(); SepetGüncelleme[] sepetUpdates = new SepetGüncelleme[grdListe.Rows.Count]; for (int i = 0; i < grdListe.Rows.Count; i++) { IOrderedDictionary rowValues = new OrderedDictionary(); rowValues = GetValues(grdListe.Rows[i]); sepetUpdates[i].UrunId = Convert.ToInt32(rowValues["Id"]); sepetUpdates[i].AlimMiktari = Convert.ToInt16(rowValues["Miktar"]); CheckBox cbRemove = (CheckBox)grdListe.Rows[i].FindControl("chkCikar"); sepetUpdates[i].UrunCikar = cbRemove.Checked; } usersShoppingCart.SepetiVeritabanındaGüncelle(sepetID, sepetUpdates); grdListe.DataBind(); }