예제 #1
0
 public static int CreateCourseBrand(CourseBrands courseBrand)
 {
     try
     {
         using (VedantaEntities ve = new VedantaEntities())
         {
             CourseBrands oldBrand = ve.CourseBrands.FirstOrDefault(cb => cb.BranchId == courseBrand.BranchId && courseBrand.Name.Equals(cb.Name, StringComparison.OrdinalIgnoreCase));
             if (oldBrand == null)
             {
                 ve.AddToCourseBrands(courseBrand);
                 return(ve.SaveChanges());
             }
             else
             {
                 return(0);
             }
         }
     }
     catch (Exception)
     {
         return(0);
     }
 }