private async Task PrepareGetDto(GetPollFormDto getPollFormDto, List <GetQuestionDto> questions) { var author = await _context.Accounts.FirstOrDefaultAsync(a => a.AccountId == getPollFormDto.AuthorId); getPollFormDto.Questions = questions; getPollFormDto.AuthorEmail = author.EMail; getPollFormDto.AuthorName = author.Name; }
private async Task <ServiceResponse <List <GetPollFormDto> > > GetQuestionsDto(PollForm updatePollFormDto, ServiceResponse <List <GetPollFormDto> > response, ICollection <GetPollFormDto> questions) { //questions?.Clear(); GetPollFormDto pollFormDto = _mapper.Map <GetPollFormDto>(updatePollFormDto); var questionsResponse = await _questionService.GetQuestions(updatePollFormDto.PollId); if (questionsResponse.Data == null) { return(response.Failure(questionsResponse.Message, questionsResponse.Code)); } pollFormDto.Questions = questionsResponse.Data; questions?.Add(pollFormDto); Console.WriteLine(questions.Count); //questions?.Last().Questions.AddRange(questionsResponse.Data); //TODO: heavy refactor return(response.Success(new List <GetPollFormDto>(), questionsResponse.Message)); }