Example #1
0
 public ReturnType AddBrand(Brand brand)
 {
     try
     {
         using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
         {
             alading.AddToBrand(brand);
             if (alading.SaveChanges() == 1)
             {
                 return(ReturnType.Success);
             }
             else
             {
                 return(ReturnType.PropertyExisted);
             }
         }
     }
     catch (SqlException sex)
     {
         return(ReturnType.ConnFailed);
     }
     catch (Exception ex)
     {
         return(ReturnType.OthersError);
     }
 }
Example #2
0
 public ReturnType AddBrand(List <Brand> brandList)
 {
     try
     {
         using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
         {
             foreach (Brand brand in brandList)
             {
                 alading.AddToBrand(brand);
             }
             alading.SaveChanges();
             return(ReturnType.Success);
         }
     }
     catch (SqlException sex)
     {
         return(ReturnType.ConnFailed);
     }
     catch (Exception ex)
     {
         return(ReturnType.OthersError);
     }
 }