Exemplo n.º 1
0
        public void Register(RegisterArticleCommand command)
        {
            command.Validate();

            if (AddNotifications(command))
            {
                return;
            }

            ArticleCategory    category = _categoryRepository.GetById(command.CategoryId);
            LedgerIdentityUser user     = _identityResolver.GetUser();

            if (NotifyNullCategory(category))
            {
                return;
            }

            Article article = new Article(command.Slug, command.Title, command.Body, command.CategoryId, user.Id);

            _articleRepository.Register(article);

            Commit();
        }
Exemplo n.º 2
0
        public IQueryable <Ticket> GetByUserId(Guid userId)
        {
            LedgerIdentityUser user = _identityResolver.GetUser();

            if (userId != user.Id)
            {
                AddNotification("Erro ao buscar", "O usuário atual não possui permissão para visualizar os dados.");
                return(Enumerable.Empty <Ticket>().AsQueryable());
            }

            return(_ticketRepository.GetByUserId(userId));
        }