public bool CancelOrder(out string error) { if (SelectedOrder == null) { error = "No Order Is Selected"; return(false); } else { if (WaiterClientModel.CancelOrder(SelectedOrder.Id)) { SelectedOrder.State = OrderState.NotRealized; ArchivedOrdersViewModel.AddArchivedOrder(SelectedOrder); ListOfOrders.Remove(SelectedOrder); error = ""; return(true); } else { error = "Failed"; return(false); } } }