private void OnUserLoggedIn(UserLoggedInMessage obj) { if (obj.IsDefault) { _initializationBlob.DefaultUser = RedditUserState; } SelfUser = new AboutUserViewModel(obj.NewAccount, DateTime.UtcNow); RaisePropertyChanged("SelfUser"); //_logger.Info("user logged in " + RedditUserState.Username); }
public async Task <IActionResult> AboutUser() { var header = this.Request.Headers["sec-fetch-site"]; if (header == "none") { return(RedirectToAction("Index", "Advertisement")); } User currentUser = await signInManager.UserManager.GetUserAsync(this.User); AboutUserViewModel model = new AboutUserViewModel { AboutMe = currentUser.AboutMe }; return(PartialView("_AboutUser", model)); }
public async Task <IActionResult> Index(string name) { Users user = await _userManager.FindByNameAsync(name); if (user != null) { AboutUserViewModel model = new AboutUserViewModel { Email = user.Email, UserName = user.UserName, name = user.name, surname = user.surname, about_yourstlf = user.about_yourstlf }; return(View(model)); } return(NotFound()); }
protected void FinishInit() { Current = this; _listingFilter = new NSFWListingFilter(); if (IsInDesignMode) { _initializationBlob = new InitializationBlob { Settings = new Dictionary<string, string>(), NSFWFilter = new Dictionary<string, bool>() }; } else { OfflineService = new OfflineService(); _initializationBlob = OfflineService.LoadInitializationBlob(""); } Settings = new Model.Settings(_initializationBlob.Settings); SettingsHub = new SettingsViewModel(Settings); RedditUserState = _initializationBlob.DefaultUser ?? new UserState(); SnooStreamViewModel.ActivityManager.OAuth = SnooStreamViewModel.RedditUserState != null && SnooStreamViewModel.RedditUserState.OAuth != null ? JsonConvert.SerializeObject(SnooStreamViewModel.RedditUserState) : ""; SnooStreamViewModel.ActivityManager.CanStore = SnooStreamViewModel.RedditUserState != null && SnooStreamViewModel.RedditUserState.IsDefault; NotificationService = new Common.NotificationService(); CaptchaProvider = new CaptchaService(); RedditService = new Reddit(_listingFilter, RedditUserState, OfflineService, CaptchaProvider, "3m9rQtBinOg_rA", null, "http://www.google.com"); Login = new LoginViewModel(); _listingFilter.Initialize(Settings, OfflineService, RedditService, _initializationBlob.NSFWFilter); CommandDispatcher = new CommandDispatcher(); SubredditRiver = new SubredditRiverViewModel(_initializationBlob.Subreddits); SelfStream = new SelfStreamViewModel(); ModStream = new ModStreamViewModel(); NavMenu = new NavMenu(Enumerable.Empty<LinkRiverViewModel>(), this); MessengerInstance.Register<UserLoggedInMessage>(this, OnUserLoggedIn); if (RedditUserState.Username != null) { SelfUser = new AboutUserViewModel(RedditUserState.Username); } }
public async Task <IActionResult> AboutUser(AboutUserViewModel model) { var header = this.Request.Headers["sec-fetch-site"]; if (header == "none") { return(RedirectToAction("Index", "Advertisement")); } if (ModelState.IsValid) { User currentUser = await signInManager.UserManager.GetUserAsync(this.User); currentUser = await db.Users.FirstOrDefaultAsync(u => u.Id == currentUser.Id); currentUser.AboutMe = model.AboutMe; db.Update <User>(currentUser); await db.SaveChangesAsync(); } return(PartialView("_AboutUser", model)); }