示例#1
0
        public string Save(Test test)
        {
            //length check
            if (test.TestName.Length < 3)
            {
                return("Name must be 3 charcters long");
            }

            //type is selected or not (check)
            if (test.TypeId.Equals(0))
            {
                return("Type is not selected.");
            }

            //unique check
            if (testGateway.IsTestExist(test.TestName))
            {
                return("Already exist");
            }

            //data insert
            int rowAffect = testGateway.SaveTest(test);

            if (rowAffect > 0)
            {
                return("Success");
            }
            return("Not save.");
        }
 public string SaveTest(Test aTest)
 {
     if (aTestGateway.IsTestExist(aTest))
     {
         message = "Test Exist";
     }
     else
     {
         int rowAffected = aTestGateway.SaveTest(aTest);
         if (rowAffected > 0)
         {
             message = "Test Saved Successfully";
         }
         else
         {
             message = "Not saved";
         }
     }
     return(message);
 }
示例#3
0
 public bool IsTestExist(Test test)
 {
     return(_testGateway.IsTestExist(test));
 }