public PostLogsController(HubDbContext dbContext, ILogger <PostLogsController> logger, IMapper mapper) : base(logger) { this.dbContext = dbContext; this.mapper = mapper; }
public ActivitiesController(HubDbContext dbContext, ILogger <ActivitiesController> logger, IMapper mapper) { this.dbContext = dbContext; this.logger = logger; this.mapper = mapper; }
public SearchController(HubDbContext dbContext, ILogger <SearchController> logger, IMapper mapper) { this.dbContext = dbContext; this.logger = logger; this.mapper = mapper; }
public PostsController(HubDbContext dbContext, ILogger <PostsController> logger, IMapper mapper, IWebHostEnvironment env) : base(logger) { this.dbContext = dbContext; this.mapper = mapper; this.isProduction = false;// env?.IsProduction() != false; }
public ActivitiesController(HubDbContext dbContext, ILogger <ActivitiesController> logger, IMapper mapper, IHostEnvironment env) : base(logger) { this.dbContext = dbContext; this.mapper = mapper; if (env?.IsProduction() == false && !mostFutureForecastActivity.HasValue) { mostFutureForecastActivity = Forecast(dbContext).Where(a => a.IsActive).OrderByDescending(a => a.StartDateTime).First().StartDateTime?.Date; } }
private IQueryable <Activity> Forecast(HubDbContext dbContext) { return(QueryAll(dbContext) .Where(a => a.IsConfirmed && !a.IsConfidential && a.ActivityKeywords.Any(ak => ak.Keyword.Name == "HQ-1P" || ak.Keyword.Name == "DB") || !a.IsConfirmed && !a.IsConfidential && a.StartDateTime.Value.Date == a.EndDateTime.Value.Date && !a.IsAllDay && a.ActivityKeywords.Any(ak => ak.Keyword.Name == "HQ-1P" || ak.Keyword.Name == "DB") || !a.IsConfirmed && !a.IsConfidential && a.StartDateTime.Value.Date == a.EndDateTime.Value.Date && a.IsAllDay && a.ActivityKeywords.Any(ak => ak.Keyword.Name == "HQ-1P" || ak.Keyword.Name == "DB") || a.IsConfirmed && a.IsConfidential && a.HqSection != 4 && a.ActivityKeywords.Any(ak => ak.Keyword.Name == "HQ-1P" || ak.Keyword.Name == "DB") || !a.IsConfirmed && a.IsConfidential && a.HqSection != 4 && a.StartDateTime.Value.Date == a.EndDateTime.Value.Date && !a.IsAllDay && a.ActivityKeywords.Any(ak => ak.Keyword.Name == "HQ-1P" || ak.Keyword.Name == "DB"))); }
public bool Validate(MqttConnectionValidatorContext context) { var optionsBuilder = new DbContextOptionsBuilder <HubDbContext>(); optionsBuilder.UseSqlServer(_configuration.GetConnectionString("HubDatabase")); HubUser user; using (var dbContext = new HubDbContext(optionsBuilder.Options)) { user = dbContext.HubUser.SingleOrDefault(new Validator(context).Predicate); } return(user != null && "HUR-ACT" == user.StatusCode); }
public bool Validate(MqttConnectionValidatorContext context) { var optionsBuilder = new DbContextOptionsBuilder <HubDbContext>(); optionsBuilder.UseSqlServer(_configuration.GetConnectionString("HubDatabase")); Agent agent; using (var dbContext = new HubDbContext(optionsBuilder.Options)) { agent = dbContext.Agent.FirstOrDefault(new Validator(context).Predicate); } return(agent != null); }
public SocialMediaPostsControllerTests() { options = new DbContextOptionsBuilder <HubDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; context = new HubDbContext(options); logger = new Mock <ILogger <SocialMediaPostsController> >(); var mockMapper = new MapperConfiguration(cfg => { cfg.AddProfile(new MappingProfile()); }); mapper = mockMapper.CreateMapper(); controller = new SocialMediaPostsController(context, logger.Object, mapper); }
public ActivitiesControllerTests() { options = new DbContextOptionsBuilder <HubDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; context = new HubDbContext(this.options); logger = new Mock <ILogger <ActivitiesController> >(); var mockMapper = new MapperConfiguration(cfg => { cfg.AddProfile(new MappingProfile()); }); mapper = mockMapper.CreateMapper(); }
public UserPreferencesControllerTests() { options = new DbContextOptionsBuilder <HubDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; context = new HubDbContext(options); logger = new Mock <ILogger <UserPreferencesController> >(); var mockMapper = new MapperConfiguration(cfg => { cfg.AddProfile(new MappingProfile()); }); mapper = mockMapper.CreateMapper(); httpContext = new DefaultHttpContext(); controllerContext = new ControllerContext() { HttpContext = httpContext, }; var config = new ConfigurationBuilder().Build(); controller = new UserPreferencesController(context, logger.Object, mapper, config); controller.ControllerContext = controllerContext; }
internal static void UpdateFromModel(this Activity dbActivity, Models.Activity activity, HubDbContext dbContext) { dbContext.Entry(dbActivity).CurrentValues.SetValues(activity); dbActivity.ContactMinistry = dbContext.Ministry.FirstOrDefault(m => m.Abbreviation == activity.ContactMinistryAbbreviation); if (activity.MinistriesSharedWith != null) { // This will also remove the unchecked ministries from dbActivity.ActivitySharedWith when the changed in the context are saved dbContext.ActivitySharedWith.RemoveRange(dbActivity.ActivitySharedWith.Where(m => !activity.MinistriesSharedWith.Contains(m.Ministry.Key))); foreach (var newMinistry in activity.MinistriesSharedWith.Where(sh => !dbActivity.ActivitySharedWith.Any(m => m.Ministry.Key == sh))) { dbActivity.ActivitySharedWith.Add(new ActivitySharedWith { Activity = dbActivity, Ministry = dbContext.Ministry.Single(m => m.Key == newMinistry) }); } } if (activity.Categories != null) { dbContext.ActivityCategories.RemoveRange(dbActivity.ActivityCategories.Where(ac => !activity.Categories.Contains(ac.Category.Name))); foreach (var newCategory in activity.Categories.Where(sh => !dbActivity.ActivityCategories.Any(ac => ac.Category.Name == sh))) { dbActivity.ActivityCategories.Add(new ActivityCategories { Activity = dbActivity, Category = dbContext.Category.Single(m => m.Name == newCategory) }); } } dbActivity.LastUpdatedDateTime = DateTime.Now; }
public CommentRepliesController(HubDbContext context) { _context = context; }
public CashPaymentsController(HubDbContext context) { _context = context; }
internal static IQueryable <Activity> QueryAll(HubDbContext dbContext) { return(dbContext.Activity.Include(a => a.ContactMinistry).Include(a => a.City) .Include(a => a.ActivityCategories).ThenInclude(ac => ac.Category) .Include(a => a.ActivitySharedWith).ThenInclude(sw => sw.Ministry)); }
private ActivitiesController Controller(HubDbContext c = null) { return(new ActivitiesController(c ?? context, logger.Object, mapper, null)); }
public UserDetailsController(HubDbContext context) { _context = context; }
public AnnualOrderDetailsController(HubDbContext context) { _context = context; }
public ShoppingCartsController(HubDbContext context) { _context = context; }
public OrgFeesController(HubDbContext context) { _context = context; }
public SocialMediaPostsController(HubDbContext dbContext, ILogger <SocialMediaPostsController> logger, IMapper mapper) : base(logger) { this.dbContext = dbContext; this.mapper = mapper; }
public OrderHeadersController(HubDbContext context) { _context = context; }
public RatingsController(HubDbContext context) { _context = context; }
public AnnualsController(HubDbContext context) { _context = context; }
public WatchListsController(HubDbContext context) { _context = context; }
public UserPreferencesController(HubDbContext dbContext, ILogger <UserPreferencesController> logger, IMapper mapper, IConfiguration Configuration) : base(logger) { this.configuration = Configuration; this.dbContext = dbContext; this.mapper = mapper; }
public AdvsController(HubDbContext context) { _context = context; }
public NewsRegistersController(HubDbContext context) { _context = context; }
public EventApplyFormsController(HubDbContext context) { _context = context; }
public MinistriesController(HubDbContext dbContext, ILogger <MinistriesController> logger, IMapper mapper) : base(logger) { this.dbContext = dbContext; this.mapper = mapper; }