public void Insert(AutorBE autor) { Autor a = new Autor { Nombres = autor.Nombres, Activo = "01" }; context.Autor.Add(a); context.SaveChanges(); }
public void Update(AutorBE autor) { Autor a = new Autor { IdAutor = autor.IdAutor, Nombres = autor.Nombres, Activo = "01" }; context.Entry(a).State = EntityState.Modified; context.SaveChanges(); }
public AutorBE Find(int id) { AutorBE autor = new AutorBE(); Autor a = context.Autor.Find(id); if (a != null) { autor = new AutorBE { IdAutor = a.IdAutor, Nombres = a.Nombres, Activo = a.Activo }; } return(autor); }
// PUT: api/Autor/5 public void Put(int id, AutorBE autor) { autor.IdAutor = id; manager.Update(autor); }
// POST: api/Autor public void Post(AutorBE autor) { manager.Insert(autor); }