public MessageRepository(IOptionsMonitor <NewBookAlertConfig> newBookAlertconfiguration) { _newBookAlertconfiguration = newBookAlertconfiguration.CurrentValue; newBookAlertconfiguration.OnChange(config => { _newBookAlertconfiguration = config; }); }
public HomeController(IOptionsSnapshot <NewBookAlertConfig> newBookAlertConfiguration, IMessageRepository messageRepository, IUserService userService, IEmailService emailService) { this.newBookAlertConfiguration = newBookAlertConfiguration.Get("InternalBook"); this.thirdPartyBookAlertConfiguration = newBookAlertConfiguration.Get("ThirdPartyBook"); this.messageRepository = messageRepository; this.userService = userService; this.emailService = emailService; }
public HomeController(IOptionsSnapshot <NewBookAlertConfig> newbookalertconfig, IMessageRepository messageRepository, IUserService userService, IEmailService emailService) { _newbookalertconfig = newbookalertconfig.Value; _messageRepository = messageRepository; _userService = userService; _emailService = emailService; }
// GET // [Route("~/")] public async Task <IActionResult> Index() { //UserEmailOptions options =new UserEmailOptions() //{ // ToEmails = new List<string>(){"*****@*****.**"}, // PlaceHolders = new List<KeyValuePair<string, string>>() // { // new KeyValuePair<string, string>("{{UserName}}","Jeremy"), // } //}; //await _emailService.SendTestEmail(options); //var g1 = Guid.NewGuid(); //var g2 = Guid.NewGuid(); //var g3 = Guid.NewGuid(); var userId = _userService.GetUserId(); var isLoggedIn = _userService.IsAuthenticated(); var value = _messageRepository.Name(); var newbookalert = new NewBookAlertConfig(); _iConfiguration.Bind("NewBookAlert", newbookalert); var newbook = _iConfiguration.GetSection("NewBookAlert"); var result = newbook.GetValue <bool>("DisplayNewBookAlert"); var bookName = newbook.GetValue <string>("BookName"); // icofiguration settings // var key3 = _iConfiguration.GetValue<bool>("DisplayNewBookAlert"); // var sttt = _iConfiguration["DisplayNewBookAlert"]; var key3 = _iConfiguration.GetValue <bool>("NewBookAlert:DisplayNewBookAlert"); var key4 = _iConfiguration.GetValue <string>("NewBookAlert:BookName"); // var result = _iConfiguration["AppName"]; // var key1 = _iConfiguration["infoObj:key1"]; // var key2 = _iConfiguration["infoObj:key2"]; // // var key3 = _iConfiguration["infoObj:key3:key3obj1"]; // ViewBag.Title = " Jeremy!"; //dynamic data = new ExpandoObject(); //data.Id = 1; //data.Name = "Jeremy"; //ViewBag.Data = data; ViewData["Name"] = "Jeremy"; CustomProperty = "CustomeProperty Value"; return(View()); }
//IOptionsSnapshot works on scoped //IOptions works on singleton public HomeController(IConfiguration iConfiguration, IOptionsSnapshot <NewBookAlertConfig> iOptions, IMessageRepository messageRepository, IUserService userService, IEmailService emailService) { _iConfiguration = iConfiguration; _messageRepository = messageRepository; _userService = userService; _emailService = emailService; // newBookAlertConfig = iOptions.Value; newBookAlertConfig = iOptions.Get("InternalBook"); thirdpartyBook = iOptions.Get("ThirdPartyBook"); }
public HomeController(IOptionsSnapshot <NewBookAlertConfig> newBookAlertconfiguration, IMessageRepository messageRepository) { _newBookAlertconfiguration = newBookAlertconfiguration.Get("InternalBook"); _thirdPartyBookconfiguration = newBookAlertconfiguration.Get("ThirdPartyBook"); _messageRepository = messageRepository; }
public HomeController(IOptionsSnapshot <NewBookAlertConfig> newBookAlertconfiguration) { _newBokAlertconfiguration = newBookAlertconfiguration.Value; }
public MessageRepository(IOptions <NewBookAlertConfig> newBookAlertConfig) { _newBookAlertConfig = newBookAlertConfig.Value; }