public async Task <IViewComponentResult> InvokeAsync()
        {
            //由于一个用户可以有多个角色,所以需要根据用户Id获取所有角色的权限,然后求合集就是用户的所有权限
            var userId = HttpContext.Session.GetString("Id");
            List <Entities.Message> messageList = await messageAppService.GetMessages();

            return(View());
        }
Beispiel #2
0
        private void RunGetMessagesCommand(Command command)
        {
            var messages = MessageAppService.GetMessages(command.User);

            foreach (var message in messages)
            {
                var translation = MessageTranslator.ToReadString(message, DateTimeProvider.GetUTCTimeNow());
                Console.WriteLine(translation);
            }
        }
Beispiel #3
0
        public async Task <ArticleDto> GetArticle(int id)
        {
            var article = await _articleRepository.GetAll().Include(x => x.Category).SingleOrDefaultAsync(x => x.Id == id);

            if (article == null)
            {
                throw ExceptionBuilder.Build(HttpStatusCode.BadRequest, new HttpException("Article not exist"));
            }
            var returnArticle = new ArticleDto();

            _mapper.Map(article, returnArticle);
            returnArticle.Messages = await _messageAppService.GetMessages(id);

            return(returnArticle);
        }
Beispiel #4
0
 public async Task <IEnumerable <MessageDto> > GetMessages(int articleId)
 {
     return(await _messageAppService.GetMessages(articleId));
 }
Beispiel #5
0
 private void WhenTheUserMessagesAreRetrieved()
 {
     RetrievedMessages = MessageService.GetMessages(CurrentUser.Name);
 }