コード例 #1
0
        public async Task <DiscussionOutput> GetDiscussion(int todoId)
        {
            var discussions      = _todoManager.GetDiscussion(todoId, 5);
            var discussionsModel = new List <DiscussionDto>();

            foreach (var discussion in discussions)
            {
                var member = new User();
                if (discussion.CreatorUserId != null)
                {
                    member = await _userManager.GetUserByIdAsync((long)discussion.CreatorUserId);
                }
                discussionsModel.Add(new DiscussionDto()
                {
                    Id      = discussion.Id,
                    Member  = member.MapTo <MemberDto>(),
                    TodoId  = todoId,
                    Message = discussion.Message,
                    Day     = discussion.CreationTime.Day,
                    Month   = GetNameFromMonth(discussion.CreationTime.Month)
                });
            }
            return(new DiscussionOutput()
            {
                Discussion = discussionsModel
            });
        }