public OrderDetailViewModel(Account account, Order order = null) { Account = account; if (order == null) { Order = new Order() { AccountId = Account.Id }; } else { Order = order; } this.Title = "Order Details"; _DataClient = DependencyService.Get<IDataClient>(); DependencyService.Get<ILocalize>(); MessagingCenter.Subscribe<Product>(this, MessagingServiceConstants.UPDATE_ORDER_PRODUCT, async catalogProduct => { Order.Item = catalogProduct.Name; Order.Price = catalogProduct.Price; OrderItemImageUrl = null; await ExecuteLoadOrderItemImageUrlCommand(); // this is to account for Android not calling OnAppearing() when the product selection modal disappears. OnPropertyChanged("Order"); }); }
public async Task DeleteOrderAsync(Order item) { try { using (var handle = Insights.TrackTime("TimeToDeleteOrder")) { await _OrderTable.DeleteAsync(item); } } catch (MobileServiceInvalidOperationException ex) { Insights.Report(ex, Insights.Severity.Error); Debug.WriteLine(@"ERROR {0}", ex.Message); } catch (Exception ex2) { Insights.Report(ex2, Insights.Severity.Error); Debug.WriteLine(@"ERROR {0}", ex2.Message); } }
public async Task SaveOrderAsync(Order item) { //Insights using (var handle = Insights.TrackTime("TimeToSaveOrder")) { if (item.Id == null) await _OrderTable.InsertAsync(item); else await _OrderTable.UpdateAsync(item); } }