public StockKeepUnitVm GetStockKeepUnit(Expression <Func <StockKeepUnit, bool> > filterPredicate = null) { StockKeepUnit stockKeepUnit = _uow.Repository <StockKeepUnit>().Get(filterPredicate, false, null); StockKeepUnitVm stockKeepUnitVm = Mapper.Map <StockKeepUnitVm>(stockKeepUnit); return(stockKeepUnitVm); }
protected override void OnNavigatedTo(NavigationEventArgs e) { stockKeepUnit = (StockKeepUnit)e.Parameter; CodeTb.Text = stockKeepUnit.Code; DescriptionTb.Text = stockKeepUnit.Description; QuantityPerUnitTb.Text = stockKeepUnit.QuantityPerUnit.ToString(); dbCtx.StockKeepUnits.Attach(stockKeepUnit); }
private async void SaveUnitButton_Click(object sender, RoutedEventArgs e) { using (DBContext dBCtx = new DBContext()) { var quantity = Convert.ToDouble(QuantityPerUnitTb.Text); if (quantity == 0 || String.IsNullOrEmpty(CodeTb.Text)) { MessageDialog message = new MessageDialog("Nie uzupełniono wszystkich pól.", "Operacja przerwana"); await message.ShowAsync(); return; } StockKeepUnit stockKeepUnit = new StockKeepUnit(CodeTb.Text, DescriptionTb.Text, quantity); dBCtx.StockKeepUnits.Add(stockKeepUnit); dBCtx.SaveChanges(); this.Frame.Navigate(typeof(MainPage), "BackToUnitsList"); } }
private void UnitsList_Tapped(object sender, TappedRoutedEventArgs e) { StockKeepUnit stockKeepUnit = UnitsList.SelectedItem as StockKeepUnit; Frame.Navigate(typeof(DetailsEditUnitsPage), stockKeepUnit); }