Exemple #1
0
 public bool Validate(InstructorDao i)
 {
     if (PrimaryKeyValidate(i.InstructorId) &&
         StringValidate(i.FirstName, 100) &&
         StringValidate(i.LastName, 100)
         )
     {
         return(true);
     }
     return(false);
 }
Exemple #2
0
 public bool DeleteInstructor(InstructorDao instructor)
 {
     try
     {
         return(ac.DeleteInstructor(emap.MapToData(instructor)));
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #3
0
 public bool UpdateInstructor(InstructorDao instructor)
 {
     try
     {
         if (instructorVal.Validate(instructor))
         {
             return(ac.UpdateInstructor(emap.MapToData(instructor)));
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #4
0
 public bool InsertInstructor(InstructorDao newinstructor)
 {
     try
     {
         if (instructorVal.Validate(newinstructor))
         {
             return(ac.InsertInstructor(emap.MapToData(newinstructor)));;
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemple #5
0
        /// <summary>
        /// Validates the data coming in from the data layer
        /// </summary>
        public bool ValidateSoapData(InstructorDao instructor)
        {
            int maxName = 50;

            if (val.ValidateInt(instructor.InstructorId) &&
                val.ValidateRequiredString(instructor.FirstName, maxName) &&
                val.ValidateRequiredString(instructor.LastName, maxName))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #6
0
        /// <summary>
        /// After successful validation, this method will map the data from the Data Layer to the Dto
        /// </summary>
        public InstructorDto MapToRest(InstructorDao i)
        {
            var mapper = instructorMapper.CreateMapper();

            return(mapper.Map <InstructorDto>(i));
        }
        public Instructor MapToData(InstructorDao instuctor)
        {
            var mapper = InstructorMapper.CreateMapper();

            return(mapper.Map <Instructor>(instuctor));
        }