/// <summary> /// Executes the add command /// </summary> public void RemoveItemExecute() { try { if (Item != null) { service.RemoveItem(Item, Service.LoggedInUser[0].UserID); UserShoppingCartList.RemoveAll(i => i.UserID == Service.LoggedInUser[0].UserID && i.ItemID == Item.ItemID); ShoppingCartList.RemoveAll(i => i.UserID == Service.LoggedInUser[0].UserID && i.ItemID == Item.ItemID); UserShoppingCartList = service.GetAllUserShoppingCarts(Service.LoggedInUser[0].UserID).ToList(); ShoppingCartList = service.GetAllShoppingCarts(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Executes the add command /// </summary> public void RemoveItemExecute() { try { if (Item != null) { service.RemoveItem(Item, LoggedUser.CurrentUser.UserID); UserShoppingCartList.RemoveAll(i => i.UserID == LoggedUser.CurrentUser.UserID && i.ItemID == Item.ItemID); ShoppingCartList.RemoveAll(i => i.UserID == LoggedUser.CurrentUser.UserID && i.ItemID == Item.ItemID); UserShoppingCartList = service.GetAllUserShoppingCarts(LoggedUser.CurrentUser.UserID).ToList(); ShoppingCartList = service.GetAllShoppingCarts(); TotalLabel = service.TotalValue(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }