コード例 #1
0
        public async Task <ViewInboxModel> Get(string id, int pageIndex = 0)
        {
            var inbox = _inboxService.GetById(Guid.Parse(id),
                                              // ugly way to get EF to recurse the parents so we can show the path to the inbox
                                              i => i.ParentInbox.ParentInbox.ParentInbox.ParentInbox.ParentInbox.ParentInbox.ParentInbox);

            var mappedInbox = _mapper.Map <ViewInboxModel>(inbox);
            var messages    = await _messagesService.GetMessagesForInbox(inbox.Id, pageIndex, 10);

            mappedInbox.Messages = _mapper.Map <PaginatedListModel <MessageSummaryModel> >(messages);

            return(mappedInbox);
        }