public IndexModel( ApplicationDbContext ApplicationDbContext, IOptions <Csc_AwsS3Settings> Csc_AwsS3Settings, IHttpContextAccessor IHttpContextAccessor, ITalentsRepository ITalentsRepository) { _ApplicationDbContext = ApplicationDbContext; _Csc_AwsS3Settings = Csc_AwsS3Settings.Value; _IHttpContextAccessor = IHttpContextAccessor; _ITalentsRepository = ITalentsRepository; PremiumUsers = _ApplicationDbContext.PremiumMembers.ToList().Select(x => x.Id).ToArray(); try { string currentUserId = _IHttpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; IsPremium = PremiumUsers.Contains(currentUserId); LoggedIn = true; } catch { IsPremium = LoggedIn = false; } S3ImgBaseUrl = _Csc_AwsS3Settings.Talents_ImgBaseUrl; }
public TalentModel( IHttpContextAccessor IHttpContextAccessor, ITalentsRepository ITalentsRepository, IOptions <Csc_AwsS3Settings> Csc_AwsS3Settings, ApplicationDbContext context) { _IHttpContextAccessor = IHttpContextAccessor; _ITalentsRepository = ITalentsRepository; _Csc_AwsS3Settings = Csc_AwsS3Settings.Value; _context = context; S3ImgBaseUrl = _Csc_AwsS3Settings.Talents_ImgBaseUrl; }
public TalentsRepository( IHostingEnvironment IHostingEnvironment, IOptions <App_SharedSettings> App_SharedSettings, IOptions <Csc_AwsS3Settings> Csc_AwsS3Settings, IAwsService IAwsService) { _IHostingEnvironment = IHostingEnvironment; _App_SharedSettings = App_SharedSettings.Value; _Csc_AwsS3Settings = Csc_AwsS3Settings.Value; _IAwsService = IAwsService; string awsCredentialsPath = _IHostingEnvironment.ContentRootPath + _App_SharedSettings.Aws_CredentialsPath; _AmazonS3Client = new AmazonS3Client( new StoredProfileAWSCredentials( _Csc_AwsS3Settings.Profile, awsCredentialsPath), RegionEndpoint.GetBySystemName(_Csc_AwsS3Settings.Region)); }