/// <summary> /// The new Order /// </summary> /// <param name="o"></param> void NewOrder(object o) { Order = new Order(); }
/// <summary> /// The Delete Order /// S1: Create an object of HttpClient /// S2: Make an async call to WEB API using 'DeleteAsync' method and pass the 'OrderId'. /// </summary> /// <param name="o"></param> async void RemoveOrder(object o) { using (var client = new HttpClient()) { var response = await client.DeleteAsync(new Uri(remoteURL + "Order/" + Order.OrderId)); response.EnsureSuccessStatusCode(); } Order = new Order(); LoadOrders(); }
public OrderViewModel() { NewOrders = new RoutedCommand(NewOrder); AddOrder = new RoutedCommand(CreateOrder); UpdateOrder = new RoutedCommand(EditOrder); DeleteOrder = new RoutedCommand(RemoveOrder); LoadOrders(); Order = new Order(); }