예제 #1
0
        public static CommentViewModel Map(Comment model)
        {
            var viewModel = mapper.Map(model);

            viewModel.AuthorId  = model.UserId;
            viewModel.Author    = AuthorMapper.Map(model.User);
            viewModel.ArticleId = model.ArticleId;
            return(viewModel);
        }
예제 #2
0
        public static QuestionViewModel Map(Question model)
        {
            var viewModel = mapper.Map(model);

            viewModel.Author      = AuthorMapper.Map(model.User);
            viewModel.AuthorId    = model.UserId;
            viewModel.Disciplines = model.Disciplines.Select(
                DisciplineMapper.Map);
            return(viewModel);
        }
예제 #3
0
        public static AnswerViewModel Map(Answer model)
        {
            //AnswerViewModel viewModel = new AnswerViewModel();
            //viewModel.Id = answer.Id;
            //viewModel.QuestionId = answer.QuestionId;
            //viewModel.Text = answer.Text;
            //viewModel.PostedDate = answer.PostedDate;
            //viewModel.Author = AuthorMapper.Map(answer.User);
            var viewModel = mapper.Map(model);

            viewModel.AuthorId   = model.UserId;
            viewModel.Author     = AuthorMapper.Map(model.User);
            viewModel.QuestionId = model.QuestionId;
            return(viewModel);
        }