Exemplo n.º 1
0
 public UserMessagesService(
     CampaignsDbContext dbContext,
     IOptions <CampaignsApiOptions> apiOptions,
     IOptions <GeneralSettings> generalSettings
     )
 {
     DbContext       = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     ApiOptions      = apiOptions?.Value ?? throw new ArgumentNullException(nameof(apiOptions));
     GeneralSettings = generalSettings?.Value ?? throw new ArgumentNullException(nameof(generalSettings));
 }
Exemplo n.º 2
0
 public CampaignService(
     CampaignsDbContext dbContext,
     IOptions <GeneralSettings> generalSettings,
     IOptions <CampaignsApiOptions> apiOptions,
     Func <string, IFileService> getFileService,
     IHttpContextAccessor httpContextAccessor,
     LinkGenerator linkGenerator
     )
 {
     DbContext           = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     ApiOptions          = apiOptions?.Value ?? throw new ArgumentNullException(nameof(apiOptions));
     FileService         = getFileService(CampaignsApi.FileServiceKey) ?? throw new ArgumentNullException(nameof(getFileService));
     GeneralSettings     = generalSettings?.Value ?? throw new ArgumentNullException(nameof(generalSettings));
     HttpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
     LinkGenerator       = linkGenerator ?? throw new ArgumentNullException(nameof(linkGenerator));
 }
Exemplo n.º 3
0
 public CampaignService(CampaignsDbContext dbcontext, IConfiguration Configuration)
 {
     _dbcontext     = dbcontext;
     _Configuration = Configuration;
 }
Exemplo n.º 4
0
 public static IEnumerable <Campaigns.Model.AttributeContribution> GetContributionsFromAttribute(this CampaignsDbContext db, int id)
 {
     return(db.AttributeContributions.Where(c => c.SourceId == id));
 }
Exemplo n.º 5
0
 public static IEnumerable <Campaigns.Model.Attribute> GetStandardAttributes(this CampaignsDbContext db)
 {
     return(db.Attributes.Where(a => a.IsStandard));
 }
Exemplo n.º 6
0
 public static IEnumerable <Campaigns.Model.Attribute> GetAttributesInCategory(this CampaignsDbContext db, string category)
 {
     return(db.Attributes.Where(a => 0 == string.Compare(a.Category, category, true)));
 }
Exemplo n.º 7
0
        //
        // DEPRECATED
        //

        public static Campaigns.Model.Attribute GetAttribute(this CampaignsDbContext db, string name, string category)
        {
            return(db.Attributes
                   .FirstOrDefault(a => 0 == string.Compare(a.Name, name, true) && 0 == string.Compare(a.Category, category, true)));
        }