public void Nested(IObjectMapperAdapter mapper)
        {
            mapper.CreateMap<Wrapper<string>, ImmutableWrapper<string>>();
            mapper.CreateMap<Wrapper<Wrapper<string>>, ImmutableWrapper<ImmutableWrapper<string>>>();

            var source = new Wrapper<Wrapper<string>> { Value = new Wrapper<string> { Value = "X" }};
            var result = mapper.Map<ImmutableWrapper<ImmutableWrapper<string>>>(source);

            Assert.Equal("X", result.Value.Value);
        }
        public void Nested(IObjectMapperAdapter mapper)
        {
            mapper.CreateMap <Wrapper <string>, ImmutableWrapper <string> >();
            mapper.CreateMap <Wrapper <Wrapper <string> >, ImmutableWrapper <ImmutableWrapper <string> > >();

            var source = new Wrapper <Wrapper <string> > {
                Value = new Wrapper <string> {
                    Value = "X"
                }
            };
            var result = mapper.Map <ImmutableWrapper <ImmutableWrapper <string> > >(source);

            Assert.Equal("X", result.Value.Value);
        }
        public void PropertyToSetMethod(IObjectMapperAdapter adapter)
        {
            adapter.CreateMap<ClassWithValue, ClassWithSetValue>();
            var source = new ClassWithValue { Value = "ABC" };
            var result = adapter.Map<ClassWithSetValue>(source);

            Assert.Equal(source.Value, result.GetValue());
        }
        public void NameBasedUnflattening(IObjectMapperAdapter adapter)
        {
            adapter.CreateMap<ClassWithNestedValue, ClassWithNested<ClassWithValue>>();
            var source = new ClassWithNestedValue { NestedValue = "ABC" };
            var result = adapter.Map<ClassWithNested<ClassWithValue>>(source);

            Assert.Equal(source.NestedValue, result.Nested.Value);
        }
        public void MethodToProperty(IObjectMapperAdapter adapter)
        {
            adapter.CreateMap<ClassWithValueAsMethod, ClassWithValue>();
            var source = new ClassWithValueAsMethod("ABC");
            var result = adapter.Map<ClassWithValue>(source);

            Assert.Equal(source.Value(), result.Value);
        }
Exemple #6
0
        public void GetMethodToProperty(IObjectMapperAdapter adapter)
        {
            adapter.CreateMap <ClassWithGetValueMethod, ClassWithValue>();
            var source = new ClassWithGetValueMethod("ABC");
            var result = adapter.Map <ClassWithValue>(source);

            Assert.Equal(source.GetValue(), result.Value);
        }
        public void NameBasedUnflattening(IObjectMapperAdapter adapter)
        {
            adapter.CreateMap <ClassWithNestedName, ClassWithNested <ClassWithName> >();
            var source = new ClassWithNestedName {
                NestedName = "ABC"
            };
            var result = adapter.Map <ClassWithNested <ClassWithName> >(source);

            Assert.Equal(source.NestedName, result.Nested.Name);
        }
        public void DictionaryEntryToProperty(IObjectMapperAdapter mapper)
        {
            mapper.CreateMap<Dictionary<string, object>, Wrapper<string>>();

            var source = new Dictionary<string, object> { { "Value", "ABC" } };
            var result = mapper.Map<Wrapper<string>>(source);

            Assert.NotNull(result);
            Assert.Equal("ABC", result.Value);
        }
        public void PropertyToDictionaryEntry(IObjectMapperAdapter mapper)
        {
            mapper.CreateMap<Wrapper<string>, Dictionary<string, object>>();

            var source = new Wrapper<string> { Value = "ABC" };
            var result = mapper.Map<Dictionary<string, object>>(source);

            Assert.NotNull(result);
            Assert.Contains(new KeyValuePair<string, object>("Value", "ABC"), result);
        }
Exemple #10
0
        public void PropertyToSetMethod(IObjectMapperAdapter adapter)
        {
            adapter.CreateMap <ClassWithValue, ClassWithSetValue>();
            var source = new ClassWithValue {
                Value = "ABC"
            };
            var result = adapter.Map <ClassWithSetValue>(source);

            Assert.Equal(source.Value, result.GetValue());
        }
Exemple #11
0
        public void NameBasedFlattening(IObjectMapperAdapter adapter)
        {
            adapter.CreateMap <ClassWithNested <ClassWithValue>, ClassWithNestedValue>();
            var source = new ClassWithNested <ClassWithValue> {
                Nested = { Value = "ABC" }
            };
            var result = adapter.Map <ClassWithNestedValue>(source);

            Assert.Equal(source.Nested.Value, result.NestedValue);
        }
        private static void AssertEnumMappingWorksFor <TSource, TTarget>(IObjectMapperAdapter mapper, TSource sourceValue, TTarget expectedValue)
        {
            mapper.CreateMap <Wrapper <TSource>, Wrapper <TTarget> >();

            var source = new Wrapper <TSource> {
                Value = sourceValue
            };
            var result = mapper.Map <Wrapper <TTarget> >(source);

            Assert.Equal(expectedValue, result.Value);
        }
        public void DictionaryEntryToProperty(IObjectMapperAdapter mapper)
        {
            mapper.CreateMap <Dictionary <string, object>, Wrapper <string> >();

            var source = new Dictionary <string, object> {
                { "Value", "ABC" }
            };
            var result = mapper.Map <Wrapper <string> >(source);

            Assert.NotNull(result);
            Assert.Equal("ABC", result.Value);
        }
        public void ExpandoObjectToClass(IObjectMapperAdapter mapper)
        {
            mapper.CreateMap<dynamic, Wrapper<string>>();

            dynamic source = new ExpandoObject();
            source.Value = "ABC";

            var result = mapper.Map<Wrapper<string>>((object)source);

            Assert.NotNull(result);
            Assert.Equal("ABC", result.Value);
        }
        public void PropertyToDictionaryEntry(IObjectMapperAdapter mapper)
        {
            mapper.CreateMap <Wrapper <string>, Dictionary <string, object> >();

            var source = new Wrapper <string> {
                Value = "ABC"
            };
            var result = mapper.Map <Dictionary <string, object> >(source);

            Assert.NotNull(result);
            Assert.Contains(new KeyValuePair <string, object>("Value", "ABC"), result);
        }
        public void ExpandoObjectToClass(IObjectMapperAdapter mapper)
        {
            mapper.CreateMap <dynamic, Wrapper <string> >();

            dynamic source = new ExpandoObject();

            source.Value = "ABC";

            var result = mapper.Map <Wrapper <string> >((object)source);

            Assert.NotNull(result);
            Assert.Equal("ABC", result.Value);
        }
        private static void AssertNullableMappingWorksFor <TSource, TTarget>(IObjectMapperAdapter mapper, TSource sourceValue, TTarget expectedValue, TTarget targetValue = default(TTarget))
        {
            mapper.CreateMap <Wrapper <TSource>, Wrapper <TTarget> >();

            var source = new Wrapper <TSource> {
                Value = sourceValue
            };

            WrapperStatic <TTarget> .NextValueAfterConstructor = targetValue;

            var result = mapper.Map <Wrapper <TTarget> >(source);

            Assert.Equal(expectedValue, result.Value);
        }
Exemple #18
0
        private static void AssertListMappingWorksFor <TSourceCollection, TTargetCollection>(IObjectMapperAdapter mapper, TSourceCollection sourceValue, TTargetCollection expectedValue)
            where TSourceCollection : IEnumerable <int>
            where TTargetCollection : IEnumerable <int>
        {
            mapper.CreateMap <Wrapper <TSourceCollection>, Wrapper <TTargetCollection> >();

            var source = new Wrapper <TSourceCollection> {
                Value = sourceValue
            };
            var result = mapper.Map <Wrapper <TTargetCollection> >(source);

            Assert.NotNull(result.Value);
            Assert.Equal(expectedValue.ToArray(), result.Value.ToArray());
        }
        private static void AssertListMappingWorksFor <TSourceCollection, TExposedTargetCollection, TActualTargetCollection>(IObjectMapperAdapter mapper, TSourceCollection sourceValue)
            where TSourceCollection : IEnumerable <int>
            where TExposedTargetCollection : IEnumerable <int>
            where TActualTargetCollection : TExposedTargetCollection, new()
        {
            mapper.CreateMap <Wrapper <TSourceCollection>, WrapperWithReadOnly <TExposedTargetCollection, TActualTargetCollection> >();

            var source = new Wrapper <TSourceCollection> {
                Value = sourceValue
            };
            var result = mapper.Map <WrapperWithReadOnly <TExposedTargetCollection, TActualTargetCollection> >(source);

            Assert.NotNull(result.Value);
            Assert.Equal(sourceValue.ToArray(), result.Value.ToArray());
        }
        private static void AssertListMappingWorksFor <TSourceCollection, TTargetCollection>(IObjectMapperAdapter mapper)
            where TSourceCollection : IEnumerable <int>
            where TTargetCollection : IEnumerable <int>
        {
            var sourceValue = new[] { 5 }.AsEnumerable();

            if (typeof(TSourceCollection) == typeof(ISet <int>))
            {
                sourceValue = new HashSet <int> {
                    5
                }
            }
            ;

            mapper.CreateMap <Wrapper <TSourceCollection>, Wrapper <TTargetCollection> >();

            var source = new Wrapper <TSourceCollection> {
                Value = (TSourceCollection)sourceValue
            };
            var result = mapper.Map <Wrapper <TTargetCollection> >(source);

            Assert.NotNull(result.Value);
            Assert.Equal(sourceValue.ToArray(), result.Value.ToArray());
        }
        /// <summary>
        /// Creates the course view models.
        /// </summary>
        /// <param name="courses">The courses.</param>
        /// <param name="objectMapper">The object mapper.</param>
        /// <returns></returns>
        public static List <CourseViewModel> CreateCourseViewModels(List <Course> courses, IObjectMapperAdapter objectMapper)
        {
            List <CourseViewModel> courseModels = new List <CourseViewModel>();

            foreach (Course courseItem in courses)
            {
                objectMapper.CreateMap <Model.Entities.CourseModule, CourseModuleViewModel>();
                CourseViewModel courseViewModel = objectMapper.Map <Model.Entities.Course, CourseViewModel>(courseItem);
                courseViewModel.Modules = new List <ModuleViewModel>();
                foreach (CourseModule courseModuleItem in courseItem.CourseModules)
                {
                    if (courseModuleItem.Module != null)
                    {
                        courseViewModel.Modules.Add(objectMapper.Map <Model.Entities.Module, ModuleViewModel>(courseModuleItem.Module));
                    }
                }

                if (courseItem.Department != null)
                {
                    courseViewModel.DepartmentName = courseItem.Department.Name;
                }

                if (courseItem.StaffCourses != null && courseItem.StaffCourses.Count > 0)
                {
                    foreach (var staffModel in courseItem.StaffCourses)
                    {
                        courseViewModel.StaffUsers = courseViewModel.StaffUsers + staffModel.Staff.FirstName;
                    }
                }

                courseViewModel.StudentCount = courseItem.CourseRegistrations.Count;
                courseModels.Add(courseViewModel);
            }

            return(courseModels);
        }
Exemple #22
0
        /// <summary>
        /// Initializes the specified object mapper.
        /// </summary>
        /// <param name="ObjectMapper">The object mapper.</param>
        public static void Initialize(IObjectMapperAdapter ObjectMapper)
        {
            // Repository Entity to Domain Entity
            ObjectMapper.CreateMap <UniEBoard.Repository.User, UniEBoard.Model.Entities.User>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Role, UniEBoard.Model.Entities.Role>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Staff, UniEBoard.Model.Entities.Staff>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Student, UniEBoard.Model.Entities.Student>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Group, UniEBoard.Model.Entities.Group>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Membership, UniEBoard.Model.Entities.Membership>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Message, UniEBoard.Model.Entities.Message>();
            ObjectMapper.CreateMap <UniEBoard.Repository.ViewedMessage, UniEBoard.Model.Entities.ViewedMessage>();
            ObjectMapper.CreateMap <UniEBoard.Repository.UserGroup, UniEBoard.Model.Entities.UserGroup>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Assignment, UniEBoard.Model.Entities.Assignment>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Submission, UniEBoard.Model.Entities.Submission>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Task, UniEBoard.Model.Entities.Task>();
            ObjectMapper.CreateMap <UniEBoard.Repository.CourseModule, UniEBoard.Model.Entities.CourseModule>();
            ObjectMapper.CreateMap <UniEBoard.Repository.CourseRegistration, UniEBoard.Model.Entities.CourseRegistration>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Module, UniEBoard.Model.Entities.Module>();
            ObjectMapper.CreateMap <UniEBoard.Repository.StaffCourse, UniEBoard.Model.Entities.StaffCourse>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Unit, UniEBoard.Model.Entities.Unit>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Course, UniEBoard.Model.Entities.Course>();
            ObjectMapper.CreateMap <UniEBoard.Repository.BaseFile, UniEBoard.Model.Entities.BaseFile>();
            ObjectMapper.CreateMap <UniEBoard.Repository.File, UniEBoard.Model.Entities.File>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Video, UniEBoard.Model.Entities.Video>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Image, UniEBoard.Model.Entities.Image>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Document, UniEBoard.Model.Entities.Document>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Asset, UniEBoard.Model.Entities.Asset>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Tag, UniEBoard.Model.Entities.Tag>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Quiz, UniEBoard.Model.Entities.Quiz>();
            ObjectMapper.CreateMap <UniEBoard.Repository.QuizEntry, UniEBoard.Model.Entities.QuizEntry>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Question, UniEBoard.Model.Entities.Question>();
            ObjectMapper.CreateMap <UniEBoard.Repository.QuestionChoice, UniEBoard.Model.Entities.QuestionChoice>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Answer, UniEBoard.Model.Entities.Answer>();
            ObjectMapper.CreateMap <UniEBoard.Repository.AnswerQuestionChoice, UniEBoard.Model.Entities.AnswerQuestionChoice>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Schedule, UniEBoard.Model.Entities.Schedule>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Topic, UniEBoard.Model.Entities.Topic>();
            ObjectMapper.CreateMap <UniEBoard.Repository.TopicPost, UniEBoard.Model.Entities.TopicPost>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Discussion, UniEBoard.Model.Entities.Discussion>();
            ObjectMapper.CreateMap <UniEBoard.Repository.BaseQuestionTopic, UniEBoard.Model.Entities.BaseQuestionTopic>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Company, UniEBoard.Model.Entities.Company>();
            ObjectMapper.CreateMap <UniEBoard.Repository.Department, UniEBoard.Model.Entities.Department>();
            ObjectMapper.CreateMap <UniEBoard.Repository.ModuleQuiz, UniEBoard.Model.Entities.ModuleQuiz>();

            // Domain Entity to Repository Entity
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Membership, UniEBoard.Repository.Membership>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Message, UniEBoard.Repository.Message>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.User, UniEBoard.Repository.User>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Role, UniEBoard.Repository.Role>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Student, UniEBoard.Repository.Student>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Staff, UniEBoard.Repository.Staff>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.ViewedMessage, UniEBoard.Repository.ViewedMessage>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.UserGroup, UniEBoard.Repository.UserGroup>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Submission, UniEBoard.Repository.Submission>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Task, UniEBoard.Repository.Task>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Assignment, UniEBoard.Repository.Assignment>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.CourseModule, UniEBoard.Repository.CourseModule>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.CourseRegistration, UniEBoard.Repository.CourseRegistration>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Module, UniEBoard.Repository.Module>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.StaffCourse, UniEBoard.Repository.StaffCourse>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Unit, UniEBoard.Repository.Unit>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Course, UniEBoard.Repository.Course>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.BaseFile, UniEBoard.Repository.BaseFile>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.File, UniEBoard.Repository.File>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Video, UniEBoard.Repository.Video>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Document, UniEBoard.Repository.Document>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Image, UniEBoard.Repository.Image>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Asset, UniEBoard.Repository.Asset>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Quiz, UniEBoard.Repository.Quiz>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.QuizEntry, UniEBoard.Repository.QuizEntry>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Question, UniEBoard.Repository.Question>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.QuestionChoice, UniEBoard.Repository.QuestionChoice>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Answer, UniEBoard.Repository.Answer>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.AnswerQuestionChoice, UniEBoard.Repository.AnswerQuestionChoice>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Schedule, UniEBoard.Repository.Schedule>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Discussion, UniEBoard.Repository.Discussion>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Topic, UniEBoard.Repository.Topic>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.TopicPost, UniEBoard.Repository.TopicPost>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.BaseQuestionTopic, UniEBoard.Repository.BaseQuestionTopic>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Company, UniEBoard.Repository.Company>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Tag, UniEBoard.Repository.Tag>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.ModuleQuiz, UniEBoard.Repository.ModuleQuiz>();
        }
Exemple #23
0
        /// <summary>
        /// Initializes the specified object mapper.
        /// </summary>
        /// <param name="ObjectMapper">The object mapper.</param>
        public static void Initialize(IObjectMapperAdapter ObjectMapper)
        {
            // Convert from Domain Model to View Model
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Student, UniEBoard.Service.Models.StudentViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Staff, UniEBoard.Service.Models.StaffViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.User, UniEBoard.Service.Models.UserViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Role, UniEBoard.Service.Models.RoleViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Group, UniEBoard.Service.Models.MessageViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Message, UniEBoard.Service.Models.MessageViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Assignment, UniEBoard.Service.Models.AssignmentViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.BaseTask, UniEBoard.Service.Models.TaskAssignmentViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Module, UniEBoard.Service.Models.ModuleViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.ModuleGrade, UniEBoard.Service.Models.ModuleGradeViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Course, UniEBoard.Service.Models.CourseViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Task, UniEBoard.Service.Models.TaskViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Assignment, UniEBoard.Service.Models.AssignmentViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Submission, UniEBoard.Service.Models.SubmissionViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.BaseFile, UniEBoard.Service.Models.BaseFileViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.File, UniEBoard.Service.Models.FileViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Submission, UniEBoard.Service.Models.AssignmentSubmissionViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Unit, UniEBoard.Service.Models.UnitViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Quiz, UniEBoard.Service.Models.Quizzes.QuizzesViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.QuizEntry, UniEBoard.Service.Models.Quizzes.QuizEntryViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Question, UniEBoard.Service.Models.Quizzes.QuestionViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.QuestionChoice, UniEBoard.Service.Models.Quizzes.QuestionChoicesViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Answer, UniEBoard.Service.Models.Quizzes.AnswerViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.AnswerQuestionChoice, UniEBoard.Service.Models.Quizzes.AnswerQuestionChoiceViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Schedule, UniEBoard.Service.Models.ScheduleViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.BaseQuestionTopic, UniEBoard.Service.Models.BaseQuestionTopicViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.TopicPost, UniEBoard.Service.Models.TopicPostViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Topic, UniEBoard.Service.Models.TopicViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Discussion, UniEBoard.Service.Models.DiscussionViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.BaseQuestionTopic, UniEBoard.Service.Models.BaseQuestionTopicViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Asset, UniEBoard.Service.Models.AssetViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Video, UniEBoard.Service.Models.VideoViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Document, UniEBoard.Service.Models.DocumentViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Image, UniEBoard.Service.Models.ImageViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Tag, UniEBoard.Service.Models.TagViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.Department, UniEBoard.Service.Models.DepartmentViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.ModuleQuiz, UniEBoard.Service.Models.ModuleQuizViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.CourseRegistration, UniEBoard.Service.Models.CourseRegistrationViewModel>();
            ObjectMapper.CreateMap <UniEBoard.Model.Entities.CourseModule, UniEBoard.Service.Models.CourseModuleViewModel>();

            // Convert from View Model to Domain Model
            ObjectMapper.CreateMap <UniEBoard.Service.Models.StudentViewModel, UniEBoard.Model.Entities.Student>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.StaffViewModel, UniEBoard.Model.Entities.Staff>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.UserViewModel, UniEBoard.Model.Entities.User>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.RoleViewModel, UniEBoard.Model.Entities.Role>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.MessageViewModel, UniEBoard.Model.Entities.Message>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.StudentViewedMessageViewModel, UniEBoard.Model.Entities.ViewedMessage>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.ModuleViewModel, UniEBoard.Model.Entities.Module>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.ModuleGradeViewModel, UniEBoard.Model.Entities.ModuleGrade>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.CourseViewModel, UniEBoard.Model.Entities.Course>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.TaskViewModel, UniEBoard.Model.Entities.Task>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.AssignmentViewModel, UniEBoard.Model.Entities.Assignment>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.SubmissionViewModel, UniEBoard.Model.Entities.Submission>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.BaseFileViewModel, UniEBoard.Model.Entities.BaseFile>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.FileViewModel, UniEBoard.Model.Entities.File>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.UnitViewModel, UniEBoard.Model.Entities.Unit>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.Quizzes.QuizzesViewModel, UniEBoard.Model.Entities.Quiz>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.Quizzes.QuizEntryViewModel, UniEBoard.Model.Entities.QuizEntry>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.Quizzes.QuestionViewModel, UniEBoard.Model.Entities.Question>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.Quizzes.QuestionChoicesViewModel, UniEBoard.Model.Entities.QuestionChoice>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.Quizzes.AnswerViewModel, UniEBoard.Model.Entities.Answer>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.Quizzes.AnswerQuestionChoiceViewModel, UniEBoard.Model.Entities.AnswerQuestionChoice>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.ScheduleViewModel, UniEBoard.Model.Entities.Schedule>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.TopicPostViewModel, UniEBoard.Model.Entities.TopicPost>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.TopicViewModel, UniEBoard.Model.Entities.Topic>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.DiscussionViewModel, UniEBoard.Model.Entities.Discussion>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.BaseQuestionTopicViewModel, UniEBoard.Model.Entities.BaseQuestionTopic>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.BaseQuestionTopicViewModel, UniEBoard.Model.Entities.BaseQuestionTopic>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.AssetViewModel, UniEBoard.Model.Entities.Asset>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.VideoViewModel, UniEBoard.Model.Entities.Video>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.DocumentViewModel, UniEBoard.Model.Entities.Document>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.ImageViewModel, UniEBoard.Model.Entities.Image>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.TagViewModel, UniEBoard.Model.Entities.Tag>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.ModuleQuizViewModel, UniEBoard.Model.Entities.ModuleQuiz>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.CourseRegistrationViewModel, UniEBoard.Model.Entities.CourseRegistration>();
            ObjectMapper.CreateMap <UniEBoard.Service.Models.CourseModuleViewModel, UniEBoard.Model.Entities.CourseModule>();
        }
 public static void CreateMap <TSource, TTarget>(this IObjectMapperAdapter mapper)
 {
     mapper.CreateMap(typeof(TSource), typeof(TTarget));
 }