Пример #1
0
 public static int CreateCourse(Courses course)
 {
     try
     {
         using (VedantaEntities islObject = new VedantaEntities())
         {
             Courses oldCourse = islObject.Courses.FirstOrDefault(c => c.ClientId == course.ClientId && c.CourseBrandId == course.CourseBrandId && course.CourseCode.Equals(c.CourseCode, StringComparison.OrdinalIgnoreCase));
             if (oldCourse == null)
             {
                 islObject.AddToCourses(course);
                 return(islObject.SaveChanges());
             }
             else
             {
                 return(0);
             }
         }
     }
     catch (Exception)
     {
         return(0);
     }
 }