Esempio n. 1
0
 public void InsertarEditorial(Model.Editorial editorial)
 {
     using (var context = new Model.BibliotecaContextContainer())
     {
         try
         {
             context.EditorialSet.Add(editorial);
             context.SaveChanges();
         }
         catch (Exception e)
         {
             throw new Exception("No se ha podido insertar la editorial ", e);
         }
     }
 }
Esempio n. 2
0
 public void ActualizarEditorial(Model.Editorial editorial)
 {
     using (var context = new Model.BibliotecaContextContainer())
     {
         try
         {
             var edi = context.EditorialSet.FirstOrDefault(x => x.EditorialId == editorial.EditorialId);
             context.Entry(edi).State = System.Data.Entity.EntityState.Modified;
             context.Entry(edi).CurrentValues.SetValues(editorial);
             context.SaveChanges();
         }
         catch (Exception e)
         {
             throw new Exception("No se ha podido actualizar la editorial ", e);
         }
     }
 }