protected override async Task DeleteItemAsync(CustomerModel model) { using (var dataProvider = ProviderFactory.CreateDataProvider()) { await dataProvider.DeleteCustomerAsync(model); } }
virtual protected async void DeleteSelection() { if (await ConfirmDeleteSelectionAsync()) { using (var dataProvider = ProviderFactory.CreateDataProvider()) { if (_selectedIndexRanges != null) { await DeleteRangesAsync(dataProvider, _selectedIndexRanges); await RefreshAsync(dataProvider); _selectedIndexRanges = null; } else if (_selectedItems != null) { await DeleteItemsAsync(dataProvider, _selectedItems); await RefreshAsync(dataProvider); _selectedItems.Clear(); _selectedItems = null; } } //IsMultipleSelection = false; } }
public async Task DeleteSelectionAsync() { using (var dataProvider = ProviderFactory.CreateDataProvider()) { await DeleteItemsAsync(dataProvider, _selectedItems); await RefreshAsync(dataProvider); } }
private async Task PopulateDetails(ProductModel selected) { using (var dataProvider = ProviderFactory.CreateDataProvider()) { var model = await dataProvider.GetProductAsync(selected.ProductID); selected.Merge(model); } }
private async Task PopulateDetails(CustomerModel selected) { using (var dataProvider = ProviderFactory.CreateDataProvider()) { var model = await dataProvider.GetCustomerAsync(selected.CustomerID); selected.Merge(model); } }
public async Task RefreshAsync() { using (var dataProvider = ProviderFactory.CreateDataProvider()) { await RefreshAsync(dataProvider); SelectedItem = Items.FirstOrDefault(); } }
protected override async Task SaveItemAsync(CustomerModel model) { using (var dataProvider = ProviderFactory.CreateDataProvider()) { await Task.Delay(100); await dataProvider.UpdateCustomerAsync(model); NotifyPropertyChanged(nameof(Title)); } }
public async Task RefreshAsync(bool resetPageIndex = false) { if (resetPageIndex) { _pageIndex = 0; } using (var dataProvider = ProviderFactory.CreateDataProvider()) { await RefreshAsync(dataProvider); } }
private async Task <IList <CustomerModel> > GetItems(string query) { using (var dataProvider = ProviderFactory.CreateDataProvider()) { var request = new DataRequest <Customer>() { Query = query, OrderBy = r => r.FirstName }; return(await dataProvider.GetCustomersAsync(0, 20, request)); } }
private async Task PopulateDetails(OrderModel selected) { if (selected != null) { using (var dataProvider = ProviderFactory.CreateDataProvider()) { var model = await dataProvider.GetOrderAsync(selected.OrderID); selected.Merge(model); } } }
override public async Task <IList <CustomerModel> > GetItemsAsync(IDataProvider dataProvider) { var request = new DataRequest <Customer>() { Query = Query, OrderBy = ViewState.OrderBy, OrderByDesc = ViewState.OrderByDesc }; var virtualCollection = new CustomerCollection(ProviderFactory.CreateDataProvider()); await virtualCollection.RefreshAsync(request); return(virtualCollection); }
private async Task <IList <ProductModel> > GetItems(string query) { using (var dataProvider = ProviderFactory.CreateDataProvider()) { var request = new PageRequest <Product>(0, 20) { Query = query, OrderBy = r => r.Name }; var page = await dataProvider.GetProductsAsync(request); return(page.Items); } }
public async Task LoadAsync(CustomerViewState state) { if (state.CustomerID > 0) { using (var dp = ProviderFactory.CreateDataProvider()) { var item = await dp.GetCustomerAsync(state.CustomerID); Item = item ?? new CustomerModel { CustomerID = state.CustomerID, IsDeleted = true }; } } else { Item = new CustomerModel(); IsEditMode = true; } }
public async Task LoadAsync(ProductViewState state) { if (!state.IsNew) { using (var dp = ProviderFactory.CreateDataProvider()) { var item = await dp.GetProductAsync(state.ProductID); Item = item ?? new ProductModel { ProductID = state.ProductID, IsDeleted = true }; } } else { Item = new ProductModel(); IsEditMode = true; } }
public async Task LoadAsync(OrderItemViewState state) { OrderID = state.OrderID; if (state.OrderLine > 0) { using (var dp = ProviderFactory.CreateDataProvider()) { var item = await dp.GetOrderItemAsync(OrderID, state.OrderLine); Item = item ?? new OrderItemModel { OrderID = state.OrderID, OrderLine = state.OrderLine, IsDeleted = true }; } } else { Item = new OrderItemModel { OrderID = OrderID }; IsEditMode = true; } }
public async Task LoadAsync(OrderViewState state) { using (var dp = ProviderFactory.CreateDataProvider()) { if (state.OrderID > 0) { var item = await dp.GetOrderAsync(state.OrderID); Item = item ?? new OrderModel { CustomerID = state.CustomerID, OrderID = state.OrderID, IsDeleted = true }; } else { Item = await dp.CreateNewOrderAsync(state.CustomerID); IsEditMode = true; } if (Item != null) { Item.CanEditCustomer = state.CustomerID <= 0; } } }