public async Task <IActionResult> SetUpWhatsSupp(SetUpViewModel setUpViewModel) { await ClearPreviousWhatsSupp(setUpViewModel.Diner.DinerId); //get geo coordinates to base search Geolocation coordinates = await _googleAPI.GetGeolocation(); //get preferences as a string to insert in the search criteria var cuisineIds = await _repo.Cuisine.GetAllCuisineIds(); var allCuisines = await GetCuisines(cuisineIds); var preferedCuisines = await _repo.CuisineJxn.GetListOfCuisinePreferences(allCuisines, setUpViewModel.Diner); var preferedCuisineString = _repo.CuisineJxn.preferencesAsString(preferedCuisines); double searchRadius = setUpViewModel.searchRadius; //run API call for nearby restaurants setUpViewModel.nearbyRestaurants = await _rapidAPI.GetNearbyRestaurants(coordinates, searchRadius, preferedCuisineString); await AddSearchToDb(setUpViewModel.nearbyRestaurants, setUpViewModel.Diner.DinerId, setUpViewModel.Diner2.DinerId); return(RedirectToAction("MyWhatsSuppTonight")); }
public async Task <IActionResult> SetupWhatsSupp() { SetUpViewModel setUpViewModel = new SetUpViewModel(); var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); setUpViewModel.Diner = await _repo.Diner.FindDiner(userId); var contactIds = await _repo.Contact.GetContactIds(setUpViewModel.Diner.DinerId); List <SelectListItem> contacts = new List <SelectListItem>(); foreach (int id in contactIds) { var result = await _repo.Diner.FindDinerByDinerId(id); SelectListItem selectListItem = new SelectListItem { Text = result.FirstName + " " + result.LastName, Value = result.DinerId.ToString() }; contacts.Add(selectListItem); } ViewData["Contacts"] = contacts; return(View(setUpViewModel)); }
public NewContact(string emergency) { var setupViewModel = new SetUpViewModel(emergency); this.BindingContext = setupViewModel; InitializeComponent(); emergencyName = emergency; }
public ActionResult SetUp() { var user = ProcessInvoke <LampblackUserProcess>().GetLampblackUser(WdContext.WdUser.Id); var model = new SetUpViewModel { UserId = user.Id, LoginName = user.LoginName, UserIdentityName = user.UserIdentityName }; return(View(model)); }
public ActionResult SetUp(SetUpViewModel model) { var propertys = new Dictionary <string, string>() { { "UserId", model.UserId.ToString() }, { "UserIdentityName", model.UserIdentityName }, { "Password", model.Password } }; model.UpdateSuccessed = ProcessInvoke <LampblackUserProcess>().UpdateUserInfo(propertys); return(View(model)); }
public IActionResult Index() { if (_logger.IsEnabled(LogLevel.Information)) { _logger.LogInformation($"Index action on SetUp controller invoked!"); } var setUpViewModel = new SetUpViewModel() { SiteName = "Plato", ConnectionString = "server=localhost;trusted_connection=true;database=plato", TablePrefix = "plato", UserName = "******", Email = "*****@*****.**", Password = "******", PasswordConfirmation = "admin" }; return(View(setUpViewModel)); }
public SetUpView(string emergency) { emergencyName = emergency; var SetupViewModel = new SetUpViewModel(emergency); this.BindingContext = SetupViewModel; InitializeComponent(); CountContact("Init", emergency); MessagingCenter.Subscribe <App>((App)Application.Current, "OnContactAdded", (sender) => { NewContact(emergency); }); MessagingCenter.Subscribe <App>((App)Application.Current, "OnContactUpdated", (sender) => { ShowContact(emergency); }); MessagingCenter.Subscribe <App>((App)Application.Current, "OnContactDeleted", (sender) => { CountContact("Delete", emergency); }); ToolbarItems.Add(new ToolbarItem("Message", "message.png", async() => { await PopupNavigation.Instance.PushAsync(new EntryMessageView(emergencyName)); })); }
public App() { _ApplicationSetUpBuilder = new ApplicationSetUpBuilder("View"); SetUpViewModel = new SetUpViewModel(_ApplicationSetUpBuilder); }
public async Task <IActionResult> SetUpPost(SetUpViewModel model) { // Ensure default shell, We cannot sign-up from tenants if (!_shellSettings.IsDefaultShell()) { return(Unauthorized()); } // Validate if (model == null) { throw new ArgumentNullException(nameof(model)); } if (string.IsNullOrEmpty(model.SessionId)) { throw new ArgumentOutOfRangeException(nameof(model.SessionId)); } if (!ModelState.IsValid) { return(View(model)); } // Get the sign-up var signUp = await _signUpStore.GetBySessionIdAsync(model.SessionId); // Ensure we found the sign-up if (signUp == null) { return(NotFound()); } // Email must be confirmed if (!signUp.EmailConfirmed) { return(Unauthorized()); } // Add company name signUp.CompanyName = model.CompanyName; // Persist var result = await _signUpManager.UpdateAsync(signUp); // Success? if (result.Succeeded) { // Redirect to sign-up confirmation return(RedirectToAction(nameof(SetUpConfirmation), new RouteValueDictionary() { ["sessionId"] = signUp.SessionId })); } // The company name may be invalid or some other issues occurred foreach (var error in result.Errors) { ViewData.ModelState.AddModelError(error.Code, error.Description); } return(await SetUp(signUp.SessionId)); }
public SetUpMain(MainWindow main) { InitializeComponent(); Main = main; DataContext = new SetUpViewModel(main); }
public async Task <IActionResult> Index(SetUpViewModel model) { if (!ModelState.IsValid) { return(View(model)); } if (!string.IsNullOrEmpty(_shellSettings.ConnectionString)) { model.ConnectionStringPreset = true; model.ConnectionString = _shellSettings.ConnectionString; } if (!string.IsNullOrEmpty(_shellSettings.TablePrefix)) { model.TablePrefixPreset = true; model.TablePrefix = _shellSettings.TablePrefix; } var setupContext = new SetUpContext() { SiteName = model.SiteName, DatabaseProvider = "SqlClient", DatabaseConnectionString = model.ConnectionString, AdminUsername = model.UserName, AdminEmail = model.Email, AdminPassword = model.Password, Errors = new Dictionary <string, string>() }; if (!model.TablePrefixPreset) { setupContext.DatabaseTablePrefix = model.TablePrefix; } if (_logger.IsEnabled(LogLevel.Information)) { _logger.LogInformation($"Beginning call to SetUpAsync"); } var executionId = await _setUpService.SetUpAsync(setupContext); // Check if a component in the Setup failed if (setupContext.Errors.Count > 0) { if (_logger.IsEnabled(LogLevel.Information)) { _logger.LogInformation($"Set-up of tenant '{setupContext.SiteName}' failed with the following errors..."); } foreach (var error in setupContext.Errors) { if (_logger.IsEnabled(LogLevel.Information)) { _logger.LogInformation(error.Key + " " + error.Value); } ModelState.AddModelError(error.Key, error.Value); } return(View(model)); } if (_logger.IsEnabled(LogLevel.Information)) { _logger.LogInformation($"Tenant with site name '{setupContext.SiteName}' created successfully"); } return(Redirect("~/")); }
public SetUp2(MainWindow setUpMain) { InitializeComponent(); DataContext = new SetUpViewModel(setUpMain); }