Esempio n. 1
0
 public ReturnType AddConfig(Config config)
 {
     try
     {
         using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
         {
             alading.AddToConfig(config);
             if (alading.SaveChanges() == 1)
             {
                 return(ReturnType.Success);
             }
             else
             {
                 return(ReturnType.PropertyExisted);
             }
         }
     }
     catch (SqlException sex)
     {
         return(ReturnType.ConnFailed);
     }
     catch (Exception ex)
     {
         return(ReturnType.OthersError);
     }
 }
Esempio n. 2
0
 public ReturnType AddConfig(List <Config> configList)
 {
     try
     {
         using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
         {
             foreach (Config config in configList)
             {
                 alading.AddToConfig(config);
             }
             alading.SaveChanges();
             return(ReturnType.Success);
         }
     }
     catch (SqlException sex)
     {
         return(ReturnType.ConnFailed);
     }
     catch (Exception ex)
     {
         return(ReturnType.OthersError);
     }
 }