public async Task TryGoogleLoginAsync(Dictionary <string, string> userDetails, IEventAggregator eventAggregator) { await UserLogOut(eventAggregator); var googleSub = userDetails["sub"]; var account = db.Accounts.Where(A => A.GoogleSub == googleSub).Select(A => A).SingleOrDefault(); if (account == null) { eventAggregator.GetEvent <OpenRegisterModeEvent>().Publish(); account = new BE.Models.Account() { GoogleSub = userDetails["sub"], GoogleProfile = new GoogleProfile() { DisplayName = userDetails["name"], GooglePlus = userDetails["profile"], Picture = userDetails["picture"] }, Profile = new Profile() { FiestName = userDetails["given_name"], LastName = userDetails["family_name"], } }; } else if (account.Profile == null) { eventAggregator.GetEvent <OpenRegisterModeEvent>().Publish(); } db.Accounts.AddOrUpdate(A => A.Id, account); db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); db.Configuration.ValidateOnSaveEnabled = true; var eventArg = new UserLogInSeccEventArg(); eventArg.Id = account.Id; eventArg.Name = userDetails["name"]; eventArg.GivenName = userDetails["given_name"]; eventArg.FamilyName = userDetails["family_name"]; eventArg.GooglePlus = userDetails["profile"]; eventArg.Picture = userDetails["picture"]; eventAggregator.GetEvent <UserLogInSeccEvent>(). Publish(eventArg); await UpdateCurrentAccount(account.Id); }
private void OpenProfile(UserLogInSeccEventArg obj) { GetIsLogOn = true; }
private void UpdateData(UserLogInSeccEventArg obj) { UpdateData(); }