public ActionResult stepOne() { if (HttpContext.Session.GetInt32("articleId") != null) { int id = (int)HttpContext.Session.GetInt32("articleId"); TempArticle tempArticle = dbContext.tempArticles.SingleOrDefault(ta => ta.Id == id); StepOneViewModel model = _mapper.Map <TempArticle, StepOneViewModel>(tempArticle); if (model != null) { model.OpenAccessAgreement = true; model.PlagiarismConfirmation = true; model.DuplicateSubmissionConfirmation = true; model.types = initializeTypesForStepOne(); } return(View(model)); } StepOneViewModel modell = new StepOneViewModel() { types = initializeTypesForStepOne(), }; return(View(modell)); }
public ActionResult stepOne(StepOneViewModel model) { if (!ModelState.IsValid) { model.types = initializeTypesForStepOne(); return(View("stepone", model)); } if (HttpContext.Session.GetInt32("articleId") != null) { int id = (int)HttpContext.Session.GetInt32("articleId"); TempArticle article = dbContext.tempArticles.SingleOrDefault(ta => ta.Id == id); article.Type = model.Type; article.Title = model.Title; article.Abstract = model.Abstract; dbContext.SaveChanges(); } else { TempArticle article = new TempArticle() { Type = model.Type, Title = model.Title, Abstract = model.Abstract, }; dbContext.tempArticles.Add(article); dbContext.SaveChanges(); HttpContext.Session.SetInt32("articleId", article.Id); } return(RedirectToAction("steptwo")); }
public ActionResult StepTwo(StepOneViewModel viewModel) { if (!ModelState.IsValid) { return(RedirectToAction("StepOne")); } var selectedSpecialtyTypeId = viewModel.SelectedSpecialty; if (selectedSpecialtyTypeId == null) { return(RedirectToAction("StepOne")); } var possibleDoctors = from d in db.Doctors where d.SpecialtyId == selectedSpecialtyTypeId select d; var possibleAssignments = from a in db.DoctorAssignments join b in possibleDoctors on a.DoctorId equals b.Id select a; var possibleMedicalCenters = from a in db.MedicalCenters join b in possibleAssignments on a.Id equals b.MedicalCenterId select a; var nextViewModel = new StepTwoViewModel { SelectedSpecialty = selectedSpecialtyTypeId, MedicalCenters = possibleMedicalCenters }; return(View("StepTwo", nextViewModel)); }
public ActionResult StepOneProcess(StepOneViewModel model) { var viewModel = new StepOneViewModel() { EthPrice = _context.SetPrices.FirstOrDefault(x => x.Status == true).Price, MinEthBuy = _context.EthPurchaseRange.FirstOrDefault().Min, MaxEthBuy = _context.EthPurchaseRange.FirstOrDefault().Max }; if (!ModelState.IsValid) { return(View("StepOne", viewModel)); } if (model.EthereumQty >= viewModel.MinEthBuy && model.EthereumQty <= viewModel.MaxEthBuy) { Session["EthereumQty"] = model.EthereumQty; return(RedirectToAction("StepTwo")); } else { ModelState.AddModelError("EthereumQty", string.Format("Minimum purchase of {0} ETH and maximum {1} ETH", viewModel.MinEthBuy, viewModel.MaxEthBuy)); return(View("StepOne", viewModel)); } }
public StepOnePage(string calledFrom) { InitializeComponent(); CalledFrom = calledFrom; BindingContext = viewmodel = new StepOneViewModel(CalledFrom); string pType = ""; if (Application.Current.Properties.ContainsKey(Constants.UserType)) { pType = (string)Application.Current.Properties[Constants.UserType]; } if (pType == Constants.Traveler) { } else { Lb_Doc.IsVisible = false; DocDate.IsVisible = false; DocDate.Date = Convert.ToDateTime("01/01/1900"); } // DisplayAlert Actions for user notifications, when was not possible, empty info and no internet available viewmodel.DisplayInvalidLoginPrompt += () => DisplayAlert(Translator.getText("Error"), Translator.getText("NoticeEmptyRegister"), "OK"); viewmodel.DisplayInvalidLoginEmpty += () => DisplayAlert(Translator.getText("Error"), Translator.getText("NoticeEmptyData"), "OK"); viewmodel.DisplayNoInternet += () => DisplayAlert(Translator.getText("Notice"), Translator.getText("NoInternet"), "OK"); viewmodel.NoRegisterCall += () => showResult(); PickerCountry.ItemsSource = viewmodel.LstItemCategories; PickerCountry.SelectedIndex = viewmodel.Index; lb_BackFunc(); void lb_BackFunc() { try { Back.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(async() => { if (CalledFrom == Constants.RegisterCall) { Application.Current.MainPage = new SelectProfilePage(); } else { await Navigation.PopModalAsync(); } } ) }); } catch (Exception ex) { Debug.WriteLine(ex); } } }
public void ShouldMainContainerBeVerticalWhenDeviceOrientationIsInPortraitMode() { //arrange viewModel = new StepOneViewModel(); //act DeviceManager.Orientation = Devices.Portrait.ToString(); //assert viewModel.MainContainerOrientation.ShouldBe(StackOrientation.Vertical); }
public void ShouldMainContainerBeHorizontalWhenDeviceOrientationIsInLandscapeMode() { //arrange viewModel = new StepOneViewModel(); //act DeviceManager.Orientation = Devices.Landscape.ToString(); //assert viewModel.MainContainerOrientation.ShouldBe(StackOrientation.Horizontal); }
public ActionResult StepOne() { var specialties = db.Specialties.ToList(); var viewModel = new StepOneViewModel { Specialties = specialties }; return(View("StepOne", viewModel)); }
public ActionResult StepOne() { var viewModel = new StepOneViewModel() { EthPrice = _context.SetPrices.FirstOrDefault(x => x.Status == true).Price, MinEthBuy = _context.EthPurchaseRange.FirstOrDefault().Min, MaxEthBuy = _context.EthPurchaseRange.FirstOrDefault().Max }; return(View(viewModel)); }
public void ShouldRefreshOrientationChangeTheOrientationOfTheMainContainer() { //arrange viewModel = new StepOneViewModel(); //act DeviceManager.Orientation = Devices.Portrait.ToString(); //assert viewModel.MainContainerOrientation.ShouldBe(StackOrientation.Vertical); DeviceManager.Orientation = Devices.Landscape.ToString(); viewModel.RefreshOrientation(); viewModel.MainContainerOrientation.ShouldBe(StackOrientation.Horizontal); }
public void ShouldExecuteSkipTutorialCommandSkipTheTutorial() { //arrange viewModel = new StepOneViewModel(); viewModel.NavigationService.SetRootPage(nameof(StepOnePage), new StepOneViewModel()); Page targetPage = new DashboardPage(); Page currentPage = viewModel.NavigationService.CurrentPage; //act Task.Run(async() => { await viewModel.ExecuteSkipTutorialCommandAsync(); }).GetAwaiter().GetResult(); currentPage = viewModel.NavigationService.CurrentMasterDetailPage; //assert NUnit.Framework.Assert.AreEqual(currentPage.Title, targetPage.Title); }