Example #1
0
 public FavoriteArticleCommandHandler(ICurrentUserContext currentUserContext, ConduitDbContext context, IMapper mapper, IDateTime dateTime)
 {
     _currentUserContext = currentUserContext;
     _context            = context;
     _mapper             = mapper;
     _dateTime           = dateTime;
 }
 public AddCommentCommandHandler(ICurrentUserContext currentUserContext, ConduitDbContext context, IMapper mapper, IDateTime dateTime)
 {
     _currentUserContext = currentUserContext;
     _context            = context;
     _mapper             = mapper;
     _dateTime           = dateTime;
 }
 public GetArticlesQueryHandler(
     UserManager <ConduitUser> userManager,
     ConduitDbContext context,
     IMapper mapper)
 {
     _userManager = userManager;
     _context     = context;
     _mapper      = mapper;
 }
Example #4
0
 public GetFeedQueryHandler(
     ICurrentUserContext currentUserContext,
     ConduitDbContext context,
     IMapper mapper)
 {
     _currentUserContext = currentUserContext;
     _context            = context;
     _mapper             = mapper;
 }
 public ProfileService(
     UserManager <IdentityUser> userManager,
     IUserPersonalizationRepository userPersonalizationRepository,
     IUserIsFollowingRepository userIsFollowingRepository,
     ConduitDbContext context)
 {
     _userManager = userManager;
     _userPersonalizationRepository = userPersonalizationRepository;
     _userIsFollowingRepository     = userIsFollowingRepository;
     _context = context;
 }
Example #6
0
        public static async Task AddActivityAndSaveChangesAsync(
            this ConduitDbContext dbContext,
            ActivityType activityType,
            TransactionType transactionType,
            string transactionId,
            CancellationToken cancellationToken)
        {
            await AddActivityAsync(dbContext, activityType, transactionType, transactionId);

            await dbContext.SaveChangesAsync(cancellationToken);
        }
Example #7
0
 public static async Task <Article> FirstArticleOrDefaultWithRelatedEntities(this ConduitDbContext context, string slug, CancellationToken cancellationToken)
 {
     return(await context.Articles
            .Include(a => a.Author)
            .ThenInclude(au => au.Followers)
            .Include(a => a.ArticleTags)
            .ThenInclude(at => at.Tag)
            .Include(a => a.Favorites)
            .ThenInclude(f => f.User)
            .FirstOrDefaultAsync(a => string.Equals(a.Slug, slug, StringComparison.OrdinalIgnoreCase), cancellationToken));
 }
Example #8
0
 public UnfollowUserCommandHandler(
     ICurrentUserContext currentUserContext,
     UserManager <ConduitUser> userManager,
     ConduitDbContext context,
     IMapper mapper)
 {
     _currentUserContext = currentUserContext;
     _userManager        = userManager;
     _context            = context;
     _mapper             = mapper;
 }
Example #9
0
 public ProfilesController(
     UserManager <IdentityUser> userManager,
     ConduitDbContext context,
     ILoggerFactory loggerFactory,
     IProfileService profileService
     )
 {
     _userManager    = userManager;
     _context        = context;
     _logger         = loggerFactory.CreateLogger <ProfilesController>();
     _profileService = profileService;
 }
Example #10
0
        private ConduitDbContext CreateContext()
        {
            var options = new DbContextOptionsBuilder <ConduitDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            var context = new ConduitDbContext(options);

            context.Database.EnsureCreated();

            return(context);
        }
Example #11
0
 public CommentService(UserManager <IdentityUser> userManager,
                       IArticleRepository articleRepository,
                       ICommentRepository commentRepository,
                       IProfileService profileService,
                       ConduitDbContext context)
 {
     _userManager       = userManager;
     _articleRepository = articleRepository;
     _commentRepository = commentRepository;
     _profileService    = profileService;
     _context           = context;
 }
 public LoginUserCommandHandler(
     UserManager <ConduitUser> userManager,
     ConduitDbContext context,
     ITokenService tokenService,
     ILogger <LoginUserCommandHandler> logger,
     IMapper mapper)
 {
     _userManager  = userManager;
     _tokenService = tokenService;
     _logger       = logger;
     _mapper       = mapper;
     _context      = context;
 }
Example #13
0
 public FollowUserCommandHandler(
     ICurrentUserContext currentUserContext,
     ConduitDbContext context,
     IMapper mapper,
     UserManager <ConduitUser> userManager,
     IDateTime dateTime)
 {
     _currentUserContext = currentUserContext;
     _context            = context;
     _mapper             = mapper;
     _userManager        = userManager;
     _dateTime           = dateTime;
 }
Example #14
0
 public UpdateUserCommandHandler(
     ICurrentUserContext currentUserContext,
     IMapper mapper,
     UserManager <ConduitUser> userManager,
     ConduitDbContext context,
     ITokenService tokenService)
 {
     _currentUserContext = currentUserContext;
     _mapper             = mapper;
     _tokenService       = tokenService;
     _userManager        = userManager;
     _context            = context;
 }
 public UpdateArticleCommandHandler(
     ILogger <UpdateArticleCommandHandler> logger,
     ConduitDbContext context,
     ICurrentUserContext currentUserContext,
     IMapper mapper,
     IDateTime dateTime)
 {
     _logger             = logger;
     _context            = context;
     _currentUserContext = currentUserContext;
     _mapper             = mapper;
     _dateTime           = dateTime;
 }
Example #16
0
 public CreateUserCommandHandler(
     ILogger <CreateUserCommandHandler> logger,
     UserManager <ConduitUser> userManager,
     ConduitDbContext context,
     IMapper mapper,
     ITokenService tokenService)
 {
     _logger       = logger;
     _userManager  = userManager;
     _mapper       = mapper;
     _context      = context;
     _tokenService = tokenService;
 }
Example #17
0
        public static ConduitDbContext Create(out ConduitUser user)
        {
            var options = new DbContextOptionsBuilder <ConduitDbContext>()
                          .UseInMemoryDatabase("Brewdude.Application.Tests.Db")
                          .Options;

            var context = new ConduitDbContext(options);

            context.Database.EnsureCreated();
            ConduitDbInitializer.Initialize(context);
            user = context.Users.FirstOrDefault();

            return(context);
        }
Example #18
0
 public ArticlesController(
     ILoggerFactory loggerFactory,
     UserManager <IdentityUser> userManager,
     ConduitDbContext context,
     IProfileService profileService,
     IArticleService articleService,
     ICommentService commentService)
 {
     _logger         = loggerFactory.CreateLogger <ArticlesController>();
     _userManager    = userManager;
     _context        = context;
     _profileService = profileService;
     _articleService = articleService;
     _commentService = commentService;
 }
Example #19
0
 public static async Task AddActivityAsync(
     this ConduitDbContext dbContext,
     ActivityType activityType,
     TransactionType transactionType,
     string transactionId)
 {
     var activityLog = new ActivityLog
     {
         ActivityType    = activityType.GetDescription(),
         TransactionId   = transactionId,
         TransactionType = transactionType,
         CreatedAt       = DateTime.UtcNow,
         UpdatedAt       = DateTime.UtcNow
     };
     await dbContext.ActivityLogs.AddAsync(activityLog);
 }
Example #20
0
 public UserService(
     SignInManager <IdentityUser> signInManager,
     UserManager <IdentityUser> userManager,
     IConfiguration config,
     ConduitDbContext context,
     ILoggerFactory loggerFactory,
     IUserPersonalizationRepository userPersonalizationRepository
     )
 {
     _signInManager = signInManager;
     _userManager   = userManager;
     _config        = config;
     _context       = context;
     _logger        = loggerFactory.CreateLogger <UserService>();
     _userPersonalizationRepository = userPersonalizationRepository;
 }
 public ArticleService(
     ConduitDbContext context,
     IArticleRepository articleRepository,
     IArticleTagsRepository articleTagsRepository,
     IFavoriteArticleRepository favoriteArticleRepository,
     IProfileService profileService,
     ITagsRepository tagsRepository,
     UserManager <IdentityUser> userManager,
     IUserIsFollowingRepository userIsFollowingRepository)
 {
     _context                   = context;
     _articleRepository         = articleRepository;
     _articleTagsRepository     = articleTagsRepository;
     _favoriteArticleRepository = favoriteArticleRepository;
     _profileService            = profileService;
     _tagsRepository            = tagsRepository;
     _userManager               = userManager;
     _userIsFollowingRepository = userIsFollowingRepository;
 }
Example #22
0
 public RepositoryWrite(ConduitDbContext dbContext)
 {
     this.dbContext = dbContext;
 }
 public ArticlesController(UserManager <ApplicationUser> userManager,
                           ConduitDbContext context)
 {
     _userManager = userManager;
     _context     = context;
 }
 public FavoriteArticleRepository(ConduitDbContext context)
 {
     _favoriteArticle = context.FavoriteArticle;
 }
Example #25
0
 public ArticleRepositoryWrite(ConduitDbContext dbContext) : base(dbContext)
 {
 }
 public ArticleCommentsQueryHandler(ConduitDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public TagsController(ConduitDbContext context)
 {
     _context = context;
 }
 public UserIsFollowingRepository(ConduitDbContext context)
 {
     _userIsFollowingDAO = context.UserIsFollowing;
 }
 public DeleteArticleCommandHandler(ILogger <DeleteArticleCommandHandler> logger, ConduitDbContext context, ICurrentUserContext currentUserContext)
 {
     _logger             = logger;
     _currentUserContext = currentUserContext;
     _context            = context;
 }
Example #30
0
 public CommentRepository(ConduitDbContext context)
 {
     _comments = context.Comment;
 }