예제 #1
0
 public static bool IngresarDatos(tb_Login login)
 {
     using (TransactionScope tran = new TransactionScope())
     {
         using (AlegriaEmbotelladaEntities bd = new AlegriaEmbotelladaEntities())
         {
             bd.tb_Login.Add(login);
             bd.SaveChanges();
             tran.Complete();
             return(true);
         }
     }
 }
예제 #2
0
 public static bool ModificarLogin(tb_Login login)
 {
     try
     {
         using (AlegriaEmbotelladaEntities bd = new AlegriaEmbotelladaEntities())
         {
             bd.Entry(login).State = System.Data.Entity.EntityState.Modified;
             bd.SaveChanges();
             return(true);
         }
     }
     catch (DbEntityValidationException dbEx)
     {
         foreach (DbEntityValidationResult entityErr in dbEx.EntityValidationErrors)
         {
             foreach (DbValidationError erorr in entityErr.ValidationErrors)
             {
                 Console.WriteLine("Error Property Name {0} : Error Message: {1}",
                                   erorr.PropertyName, erorr.ErrorMessage);
             }
         }
     }
     return(false);
 }