예제 #1
0
        public ArticleAppService(IArticleDomainService articleDomainService,
                                 ICategoryDomainService categoryDomainService) : base()
        {
            this._articleDomainService  = articleDomainService;
            this._categoryDomainService = categoryDomainService;

            MapperConfiguration configuration = new MapperConfiguration(config => {
                // because tags should be included, and if not include we should not return a empty array []
                config.AllowNullCollections = true;

                config.AddProfile(new AgentMapperProfile());
                config.AddProfile(new CategoryMapperProfile());

                config.CreateMap <Article, ArticleDto>();
                config.CreateMap <Article, ArticleWithIncludeDto>();
                config.CreateMap <ArticleTag, Guid>().ConvertUsing(t => t.TagId);

                config.CreateMap <ArticleCreateDto, Article>();
                config.CreateMap <ArticleUpdateDto, ArticleUpdateBo>();

                config.CreateMap <ArticleTagsDto, Article>();
                config.CreateMap <Article, ArticleTagsDto>();
            });

            this.Mapper = configuration.CreateMapper();
        }
 public CategoryCommandHandler(ICategoryDomainService categoryDomainService,
                               IRepository <CategoryBase> repository,
                               IRepository <Product> productRepository)
 {
     _categoryDomainService = categoryDomainService;
     _repository            = repository;
     _productRepository     = productRepository;
 }
예제 #3
0
 public ArticleAppService(IArticleDomainService articleDomainService,
                          ICategoryDomainService categoryDomainService,
                          ITagDomainService tagDomainService,
                          IAgentDomainService agentDomainService) : base()
 {
     this._articleDomainService  = articleDomainService;
     this._categoryDomainService = categoryDomainService;
     this._tagDomainService      = tagDomainService;
     this._agentDomainService    = agentDomainService;
 }
예제 #4
0
 public ArticleAppService(IArticleDomainService articleDomainService,
                          ITagDomainService tagDomainService,
                          IArticleTagRelationDomainService articleTagRelationDomainService,
                          ICategoryDomainService categoryDomainService) : base(articleDomainService)
 {
     this._articleDomainService            = articleDomainService;
     this._tagDomainService                = tagDomainService;
     this._articleTagRelationDomainService = articleTagRelationDomainService;
     this._categoryDomainService           = categoryDomainService;
 }
예제 #5
0
        public CategoryAppService(ICategoryDomainService domainService) : base()
        {
            this._domainService = domainService;
            var configuration = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <CategoryDto, Category>();
                cfg.CreateMap <Category, CategoryDto>();
            });

            this.Mapper = configuration.CreateMapper();
        }
 public BlogDomainService(
     IUnitOfWorkScopeFactory baseUnitOfWorkScopeFactory,
     IBlogPostDomainService blogPostDomainService,
     ICategoryDomainService categoryDomainService,
     ITagDomainService tagDomainService,
     IAuthorDomainService authorDomainService)
     : base(baseUnitOfWorkScopeFactory)
 {
     BlogPostDomainService = blogPostDomainService;
     CategoryDomainService = categoryDomainService;
     TagDomainService      = tagDomainService;
     AuthorDomainService   = authorDomainService;
 }
예제 #7
0
        public void Publish(Guid articleId)
        {
            Article article = _repository.Get(articleId);

            ICategoryDomainService categoryDomainService = _container.Resolve <ICategoryDomainService>();

            Category category = categoryDomainService.Get(article.CategoryId);

            if (category.IsPublished)
            {
                if (article.Status != ArticleStatus.AUDITED)
                {
                    throw new Exception("Article needs to be audited first.");
                }
                article.Status = ArticleStatus.PUBLISHED;
            }
            else
            {
                throw new Exception("You can only publish article below the public category.");
            }
        }
예제 #8
0
 public CategoryAppService(ICategoryDomainService domainService) : base()
 {
     this._domainService = domainService;
 }
예제 #9
0
 public CategoryAppService(ICategoryDomainService categoryDomainService)
 {
     this._categoryDomainService = categoryDomainService;
 }
예제 #10
0
 public CategoryAppService(ICategoryDomainService categoryDomainService, IArticleAppService articleAppService) : base(categoryDomainService)
 {
     this._articleAppService = articleAppService;
 }