private async void btnAdd_Click(object sender, RoutedEventArgs e) { await DataAccess.AddAsync(tbxInput.Text, tbxInput1.Text, tbxInput2.Text); var gg = DataAccess.GetAll(); lvOutput.ItemsSource = gg.ToList(); }
private async void btbAdd_Click(object sender, RoutedEventArgs e) //vad jag vill göra när jag trycker på knappen { //skapa 1 newperson , ++til model del await DataAccess.AddAsync(tbxInput.Text); //förväntas string // await DataAccess.AddAsync(new Person { Name = tbxInput.Text }); //förväntas person object - inte string // i add f. skapa person object att kan uttveckla mer / i den person finns name som jag stoppar in lvOutput.ItemsSource = DataAccess.GetAllAsync(); //listview -när trycker på knapp --populeras }
private async void btnSaveProblem_Click(object sender, RoutedEventArgs e) { Problem problem = new Problem(tbCustomer.Text, tbTitle.Text, "New", tbDescription.Text); await DataAccess.AddAsync(problem); lvNewProblems.ItemsSource = DataAccess.GetAllNew(); tbCustomer.Text = String.Empty; tbTitle.Text = String.Empty; tbDescription.Text = String.Empty; }
private async void btnSave_Click(object sender, RoutedEventArgs e) { Customer customer = new Customer(Convert.ToInt64(tbxSsno.Text), tbxFirstName.Text, tbxLastName.Text, Convert.ToInt64(tbxPhoneNumber.Text), tbxMailAdress.Text); Ticket ticket = new Ticket(tbxTitel.Text, cmbCategory.Text, tbxDescription.Text); await DataAccess.AddAsync(customer, ticket); tbxSsno.Text = ""; tbxFirstName.Text = ""; tbxLastName.Text = ""; tbxPhoneNumber.Text = ""; tbxMailAdress.Text = ""; tbxTitel.Text = ""; tbxDescription.Text = ""; cmbCategory.SelectedIndex = -1; }
private async void Button_Click(object sender, RoutedEventArgs e) { try { if (tbxClientname.Text != string.Empty && tbxTitle.Text != string.Empty && tbxProblem.Text != string.Empty) { Case cases = new Case(tbxClientname.Text, tbxTitle.Text, tbxProblem.Text, "New"); await DataAccess.AddAsync(cases); lvOutput.ItemsSource = DataAccess.GetAllNew(); tbxClientname.Text = string.Empty; tbxTitle.Text = string.Empty; tbxProblem.Text = string.Empty; } } catch { } }
public async Task <int> NewProductsAsync(List <Products> products) { int vResult = 0; try { foreach (var product in products) { await _ctx.AddAsync(product); } vResult = await _ctx.SaveChangesAsync(); return(vResult); } catch (System.Exception) { throw; } }