Beispiel #1
0
        public string SaveCourse(Course aCourse)
        {
            if (aCourse.Code.Length > 5)
            {
                bool isCourseCodeExist = CheckCourseCode(aCourse);

                if (isCourseCodeExist)
                {
                    return("This Course Code is already exist! Please use another Course Code");
                }
                else
                {
                    var rowAffected = gateway.AddCourse(aCourse);

                    if (rowAffected > 0)
                    {
                        return("Saved Successfully!");
                    }
                    else
                    {
                        return("Save Failed!");
                    }
                }
            }
            else
            {
                return("Invalid Reg. No.! it must be at least 6 characters.");
            }
        }
 public string AddCoures(Course aCourse)
 {
     if (aCourse.Code.Length >= 5)
     {
         if (aCourseGateway.IsExixstByCode(aCourse.Code))
         {
             if (aCourseGateway.IsExixstByName(aCourse.Name))
             {
                 if (aCourse.Credit >= (decimal).5)
                 {
                     if (aCourse.Credit <= 5)
                     {
                         int rowAffected = aCourseGateway.AddCourse(aCourse);
                         if (rowAffected > 0)
                         {
                             return("Course Saved");
                         }
                         else
                         {
                             return("Course Not Saved");
                         }
                     }
                     else
                     {
                         return("Credit Must Be With in 5");
                     }
                 }
                 else
                 {
                     return("Credit Must Be getter than .5");
                 }
             }
             else
             {
                 return("Course Name Already Exists");
             }
         }
         else
         {
             return("Course code already Exists");
         }
     }
     else
     {
         return("Course  Code Must Be Atleast 5 charcter");
     }
 }