public ProcessTestCompleteView AsCompleteView() { Mapper.Initialize ( c => c.CreateMap <StudentTestEntity, ProcessTestCompleteView>() .ForMember(m => m.TestDetailView, m => m.MapFrom(r => TestEntity.AsProcessView())) .ForMember(m => m.CountOfTotalAnswers, m => m.MapFrom(r => r.NumberAnswers)) .ForMember(m => m.CountOfCorrectAnswers, m => m.MapFrom(r => r.ValidAnswers)) .ForMember(m => m.BeginDate, m => m.MapFrom(r => r.StartedDateTime)) .ForMember(m => m.EndDate, m => m.MapFrom(r => r.CompleteDateTime)) ); return(Mapper.Map <ProcessTestCompleteView>(this)); }
public ProcessTestWhileView TakeWhileView() { var question = TakeQuestion(); Mapper.Initialize ( c => c.CreateMap <StudentTestEntity, ProcessTestWhileView>() .ForMember(m => m.TestDetailView, m => m.MapFrom(r => TestEntity.AsProcessView())) .ForMember(m => m.CountOfQuestions, m => m.MapFrom(r => r.TestEntity.CountQuestionEntities)) .ForMember(m => m.CurrentOfQuestions, m => m.MapFrom(r => r.NumberAnswers)) .ForMember(m => m.QuestionName, m => m.MapFrom(r => question.QuestionMessage)) .ForMember(m => m.AnswerModel, m => m.MapFrom(r => new ProcessAnswerModel { AnswerViews = new SelectList(question.AnswerEntities.ToList(), "AnswerId", "AnswerMessage") })) ); return(Mapper.Map <ProcessTestWhileView>(this)); }