private void btnEliminarAutor_Click(object sender, EventArgs e) { Author nuevo = new Author() { au_id = "222-17-9392", au_fname = "Don Manuel", au_lname = "Belgrano", phone = "052 242-0064", contract = true }; AdminAuthor.Delete(nuevo); MostrarAutores(); }
private void btnInsertarAutor_Click(object sender, EventArgs e) { Author nuevo = new Author() { au_id = "222-17-9392", au_fname = "Manuel", au_lname = "Belgrano", phone = "552 242-6664", contract = true }; AdminAuthor.Create(nuevo); MostrarAutores(); }
public ActionResult UpdateAuthor(int id) { GetCountries(); using (var context = new DataContext()) { var author = context.Authors.Include("Country").FirstOrDefault(a => a.Id == id); var updateAuthor = new AdminAuthor { Name = author.Name, CountryId = author.Country.Id, IsEditPage = true }; return(View("AddAuthor", updateAuthor)); } }
private void btnInsertarAutor_Click_1(object sender, EventArgs e) { Author nuevo = new Author() { Au_id = "9956", Au_lname = "Jean Doe", Au_fname = "Doo", Phone = "2453-123", Address = "Alem 22", City = "La Plata", State = "BA", Zip = "6352", Contract = true }; int filas = AdminAuthor.Agregar(nuevo); MostrarPublishers(); }
public ActionResult UpdateAuthor(AdminAuthor author) { if (!ModelState.IsValid) { GetCountries(); return(View(author)); } using (var context = new DataContext()) { var updateAuthor = context.Authors.Include("Country").FirstOrDefault(a => a.Id == author.Id); updateAuthor.Name = author.Name; updateAuthor.Country = context.Countries.FirstOrDefault(c => c.Id == author.CountryId); context.SaveChanges(); } return(Redirect("/admin/authors")); }
public ActionResult AddAuthor(AdminAuthor author) { if (!ModelState.IsValid) { GetCountries(); return(View(author)); } using (var context = new DataContext()) { var authorSave = new Author { Name = author.Name, Country = context.Countries.FirstOrDefault(c => c.Id == author.CountryId), Create = DateTime.Now }; context.Authors.Add(authorSave); context.SaveChanges(); } return(Redirect("/admin/authors")); }
private void btnIdAutor_Click(object sender, EventArgs e) { Author au = AdminAuthor.GetAuthor(txtIdAutor.Text); MessageBox.Show(au.au_fname + " " + au.au_lname); }
private void btnCiudadAutor_Click(object sender, EventArgs e) { string city = txtCiudadAutor.Text; gridPubs.DataSource = AdminAuthor.GetList(city); }
private void MostrarAutores() { gridPubs.DataSource = AdminAuthor.GetList(); }