private void addAuthor_Click(object sender, EventArgs e) { AddAuthor addAuthorForm = new AddAuthor(this.currentUser); addAuthorForm.FormClosed += new FormClosedEventHandler(AddAuthorClosed); addAuthorForm.ShowDialog(); }
public ActionResult CreateAuthor(AddAuthor addAuthor) { if (ModelState.IsValid) { try { using (db) { var row = new Autorzy { imie = addAuthor.imie, nazwisko = addAuthor.nazwisko, dataUrodzenia = addAuthor.dataUrodzenia, }; db.Autorzy.Add(row); db.SaveChanges(); ViewBag.Message = "Autor dodany"; } } catch (Exception) { } } return(View(addAuthor)); }
public async Task Handle(AddAuthor message, CancellationToken cancellationToken) { AuthorEntityHandler.Add(message.Author); await Mediator.Send(new SaveChanges()); await Mediator.Publish(new AuthorAdded(message.Author, message.UserId)); }
public ActionResult <Author> Post([FromBody] AddAuthor author) { var newAuthor = new Author { Age = author.Age, Name = author.Name }; _BooksDbContext.Authors.Add(newAuthor); _BooksDbContext.SaveChanges(); return(newAuthor); }
public Author Post([FromBody] AddAuthor authorItem) { try { var newAuthor = new Author { Name = authorItem.Name, Age = authorItem.Age }; _shopOnlineDbContext.Authors.Add(newAuthor); _shopOnlineDbContext.SaveChanges(); return(newAuthor); } catch (Exception ex) { throw ex; } }
private void EditAuthorBtn_Click(object sender, RoutedEventArgs e) { AuthorViewModel authorVM = dataGrid.SelectedItem as AuthorViewModel; AddAuthor editAuthor = new AddAuthor(authorVM.Name, authorVM.SurName); if (editAuthor.ShowDialog().Value) { string name = editAuthor.Name.Text; string surname = editAuthor.Surname.Text; if (authorVM != null && name != null && surname != null) { Author author = authorController.GetById(authorVM.Id); author.Name = authorVM.Name = name; author.SurName = authorVM.SurName = surname; authorController.Edit(author); } } }
private void AddAuthorBtn_Click(object sender, RoutedEventArgs e) { InitDataSource(ref authorItems, Mapper.AuthorsToAuthorViewModels, authorController.Get); AddAuthor addAuthor = new AddAuthor(); if (addAuthor.ShowDialog().Value) { string name = addAuthor.Name.Text; string surname = addAuthor.Surname.Text; if (name != null && surname != null) { Author author = new Author(name, surname); authorController.Add(author); authorItems.Add(Mapper.AuthorToAuthorViewModel(author)); return; } } }
private void ButAddAuthor_Click(object sender, EventArgs e) { AddAuthor _authorForm = new AddAuthor(this); _authorForm.ShowDialog(); if (_authorForm.flag) { try { _db.Authprs.Add(new Authors { FIO = _authorForm.FIO, Year = Int32.Parse(_authorForm.YearBorn) }); _db.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void addAuthorbtn_Click(object sender, EventArgs e) { try { AddAuthor addAuthor = new AddAuthor(); addAuthor.ShowDialog(); if (isChanged) { InformationForm information = new InformationForm("An author is added.", "Info"); information.Show(); } } catch (Exception) { MessageBox.Show("Something wrong!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.ViewAuthors_Load(sender, e); } }
private void Button_Click(object sender, RoutedEventArgs e) { AddAuthor addAuthor = new AddAuthor(); addAuthor.Show(); }
private void menu_addAuthor_Click(object sender, RoutedEventArgs e) { addAuthor = new AddAuthor(); addAuthor.Show(); }
private void addAuthorToolStripMenuItem_Click(object sender, EventArgs e) { AddAuthor addAuthorForm = new AddAuthor(this.currentUser); addAuthorForm.ShowDialog(); }
private void AppBarButton_Click(object sender, System.Windows.RoutedEventArgs e) { AddAuthor a = new AddAuthor(); a.ShowDialog(); }
private void newAuthor_Click(object sender, EventArgs e) { AddAuthor?.Invoke(sender, e); }