public static bool DeleteData(Basket_Item x) { Basket_Item.UpdateData(x); return(BaseDataBase._StoredProcedure("sp_Delete_Basket_Item" , new SqlParameter("@BasketID", x.Basket.Id) , new SqlParameter("@ItemID", x.RelatedItem.Id))); }
private void btnSave_Click(object sender, RoutedEventArgs e) { var i = this.DataContext as Item; if (i.IsValidate()) { if (!i.Id.HasValue) { if (Item.InsertData(i)) { MyMessage.InsertMessage(); } } else { if (Item.UpdateData(i)) { MyMessage.UpdateMessage(); } } foreach (var item in i.BasketItems) { if (item.Basket == null) { item.Basket = i; Basket_Item.InsertData(item); } else { Basket_Item.UpdateData(item); } } foreach (var item in DeletedItems) { Basket_Item.UpdateData(item); Basket_Item.DeleteData(item); } } }