public AnswerDto MapAnswer(Answer answer)
 {
     return(new AnswerDto
     {
         Id = answer.Id.DbId,
         Body = answer.Body,
         IsChosen = answer.IsChosen,
         Responder = _userService.GetUserFullName(answer.Responder.DbId),
         CreationDateTime = DatetimeConvertor.ConvertToPersianDate(answer.CreationDateTime)
     });
 }
Beispiel #2
0
 public QuestionDetailsDto MapQuestion(Question question, IReadOnlyCollection <Tag> tags)
 {
     return(new QuestionDetailsDto
     {
         Id = question.Id.DbId,
         Title = question.Title,
         Body = question.Body,
         Inquirer = _userService.GetUserFullName(question.Inquirer.DbId),
         InquirerId = question.Inquirer.DbId,
         CreationDateTime = DatetimeConvertor.ConvertToPersianDate(question.CreationDateTime),
         Tags = TagMapper.MapTags(question.Tags.ToList(), tags),
         Votes = question.CalculateVotes()
     });
 }
Beispiel #3
0
 public QuestionDto MapQuestion(Question question, IReadOnlyCollection <Tag> tags, long answers)
 {
     return(new QuestionDto
     {
         Id = question.Id.DbId,
         Title = question.Title,
         //Body = question.Body,
         Inquirer = _userService.GetUserFullName(question.Inquirer.DbId),
         //InquirerId = question.Inquirer.DbId,
         HasTrueAnswer = question.HasTrueAnswer,
         CreationDateTime = DatetimeConvertor.ConvertToPersianDate(question.CreationDateTime),
         Tags = TagMapper.MapTags(question.Tags.ToList(), tags),
         Views = question.Views.Count,
         Votes = question.CalculateVotes(),
         Answers = answers
     });
 }