public ActionResult Details(int?id, int?subId) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Product SelectPro = db.Products.Find(id); if (SelectPro == null) { return(HttpNotFound()); } var defaultModel = new DefaultViewModel { productList = db.Products.Where(p => p.SubCategory.Id == subId).ToList(), CategoryName = db.Categories.ToList(), SubCategoryName = db.SubCategories.ToList(), ProImage = db.ProductImages.Where(pri => pri.ProductId == id).ToList(), ProductDetail = db.Products.FirstOrDefault(pr => pr.Id == id), //OptionPro=db.ProductOptions.Where(a=>a.Id==id).ToList(), aboutTech = db.AboutUs.FirstOrDefault(), OneCategory = db.Categories.Where(ca => ca.Id == id).FirstOrDefault(), OneSubCategory = db.SubCategories.Where(sb => sb.Id == subId).FirstOrDefault(), }; ViewBag.subId = subId; ViewBag.catId = id; return(View(defaultModel)); }
// GET: Product public ActionResult Product(int?id, int?subId, int Page = 1) { var selectPro = new List <Product>(); if (id == null) { return(RedirectToAction("Index", "Home")); } if (subId == null) { selectPro = db.Products.Where(pr => pr.SubCategory.CategoryId == id).OrderByDescending(pr => pr.Id).ToList(); } else { selectPro = db.Products.Where(pr => pr.SubCategory.CategoryId == id && pr.SubCategoryId == subId).OrderByDescending(pr => pr.Id).ToList(); } var defaultModel = new DefaultViewModel { CategoryName = db.Categories.ToList(), SubCategoryName = db.SubCategories.ToList(), aboutTech = db.AboutUs.FirstOrDefault(), productList = selectPro, OneCategory = db.Categories.Where(ca => ca.Id == id).FirstOrDefault(), OneSubCategory = db.SubCategories.Where(sb => sb.Id == subId).FirstOrDefault(), marka = db.Markas.Where(pr => pr.SubCategoryId == subId).OrderByDescending(pr => pr.Id).ToList() }; ViewBag.proMax = db.Products.Where(sb => sb.SubCategory.Category.Id == id).Max(pr => pr.Price); ViewBag.proMin = db.Products.Where(sb => sb.SubCategory.Category.Id == id).Min(pr => pr.Price); ViewBag.subId = subId; ViewBag.catId = id; return(View(defaultModel)); }
/// <summary> /// Invoked when a filter is selected using the ComboBox in snapped view state. /// </summary> /// <param name="sender">The ComboBox instance.</param> /// <param name="e">Event data describing how the selected filter was changed.</param> private void Filter_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Determine what filter was selected var selectedFilter = e.AddedItems.FirstOrDefault() as Filter; if (selectedFilter != null) { // Mirror the results into the corresponding Filter object to allow the // RadioButton representation used when not snapped to reflect the change selectedFilter.Active = true; DefaultViewModel["Results"] = _results[selectedFilter.Name]; // Ensure results are found object results; ICollection resultsCollection; if (DefaultViewModel.TryGetValue("Results", out results) && (resultsCollection = results as ICollection) != null && resultsCollection.Count != 0) { VisualStateManager.GoToState(this, "ResultsFound", true); return; } } // Display informational text when there are no search results. VisualStateManager.GoToState(this, "NoResultsFound", true); }
public ActionResult Index(Container currentPage) { using (IDocumentSession session = this.store.OpenSession()) { var hero = new Hero { Heading = "HALCYONDAYS", Caption = "An exclusive HTML5/CSS3 freebie by Peter Finlan, for Codrops", ArticleUrl = "http://tempuri.org", ActionText = "Back to the article" }; session.Store(hero); session.SaveChanges(); var navigationContext = new NavigationContext(ControllerContext.RequestContext); var viewModel = new DefaultViewModel<Container> { CurrentPage = currentPage, NavigationContext = navigationContext }; return View(viewModel); } }
protected void Testar(object sender, EventArgs e) { // Chamando esse método, os valores dos controles serão populados de volta à model viewModel = mapper.MapToModel(); viewModel.Nome = string.Format("Alterado {0:dd/MM/yyyy hh:mm:ss} --> {1}", viewModel.DataNascimento, viewModel.EstadoCivil); mapper.MapToControls(); }
public ActionResult Index(Container currentPage) { using (IDocumentSession session = this.store.OpenSession()) { var hero = new Hero { Heading = "HALCYONDAYS", Caption = "An exclusive HTML5/CSS3 freebie by Peter Finlan, for Codrops", ArticleUrl = "http://tempuri.org", ActionText = "Back to the article" }; session.Store(hero); session.SaveChanges(); var navigationContext = new NavigationContext(ControllerContext.RequestContext); var viewModel = new DefaultViewModel <Container> { CurrentPage = currentPage, NavigationContext = navigationContext }; return(View(viewModel)); } }
private async Task RefreshSongs() { var rpcRequestFallback = true; if (DefaultViewModel.ContainsKey("SongsInPlaylist")) { var songs = ((ObservableCollection <Song>)defaultViewModel["SongsInPlaylist"]); if (songs.Any()) { defaultViewModel["SongsInPlaylist"] = null; defaultViewModel["SongsInPlaylist"] = songs; rpcRequestFallback = false; } } if (rpcRequestFallback) { ConnectionManager.ManageSystemTray(true); try { var tmpList = (List <Song>) await Playlist.GetItems(PlayelistType.Audio); if (tmpList.Any()) { defaultViewModel["SongsInPlaylist"] = new ObservableCollection <Song>(tmpList); } } catch (Exception) {} ConnectionManager.ManageSystemTray(false); } }
public AppViewModel(IEventAggregator eventAggregator, IWindowManager windowManager) { DisplayName = "Redis Explorer"; //SetTheme(); this.eventAggregator = eventAggregator; eventAggregator.Subscribe(this); this.windowManager = windowManager; Servers = new BindableCollection <RedisServer>(); KeyViewModel = new KeyViewModel(eventAggregator); KeyViewModel.ConductWith(this); DefaultViewModel = new DefaultViewModel(); DefaultViewModel.ConductWith(this); ServerViewModel = new ServerViewModel(eventAggregator); ServerViewModel.ConductWith(this); DatabaseViewModel = new DatabaseViewModel(eventAggregator); DatabaseViewModel.ConductWith(this); ActivateItem(DefaultViewModel); LoadServers(); }
public ActionResult Index(Container currentPage) { using (IDocumentSession session = this.store.OpenSession()) { //var hero = new Hero //{ // Heading = "HALCYONDAYS", // Caption = "An exclusive HTML5/CSS3 freebie by Peter Finlan, for Codrops", // ArticleUrl = "http://tempuri.org", // ActionText = "Back to the article" //}; //session.Store(hero); //session.SaveChanges(); var revisions = session.Advanced.Revisions.GetFor <Container>(currentPage.Id).Where(x => x.Metadata.IsPublished); var navigationContext = new NavigationContext(ControllerContext.RequestContext); var viewModel = new DefaultViewModel <Container> { CurrentPage = currentPage, NavigationContext = navigationContext }; return(View(viewModel)); } }
/// <summary> /// If we've lost focus and returned to this app, reload the store, as the on-disk content might have /// been changed by the background task. /// </summary> /// <param name="sender">Ignored</param> /// <param name="args">Ignored</param> private async void CoreWindow_VisibilityChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.VisibilityChangedEventArgs args) { if (args.Visible == true) { await DefaultViewModel.LoadTrips(); } }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Product SelectPro = db.Products.Find(id); if (SelectPro == null) { return(HttpNotFound()); } var defaultModel = new DefaultViewModel { Category = db.Categories.ToList(), SubCategory = db.SubCategories.ToList(), ProImage = db.Products.Where(pri => pri.Id == id).ToList(), ProductDetail = db.Products.FirstOrDefault(pr => pr.Id == id), productList = db.Products.Where(pr => pr.Id == id).ToList(), //OptionPro=db.ProductOptions.Where(a=>a.Id==id).ToList(), }; return(View(defaultModel)); }
// GET: Products public ActionResult Product(int?id) { if (id == null) { return(RedirectToAction("Index", "Home")); } SubCategory subcatId = db.SubCategories.FirstOrDefault(sub => sub.İd == id); if (subcatId == null) { return(RedirectToAction("Index", "Home")); } Category catId = db.Categories.FirstOrDefault(sub => sub.Id == id); if (catId == null) { return(RedirectToAction("Index", "Home")); } var defaultModel = new DefaultViewModel { Category = db.Categories.ToList(), SubCategory = db.SubCategories.ToList(), productList = db.Products.Where(pr => pr.subCategoryId == subcatId.İd || pr.SubCategory.CategoryId == catId.Id).ToList(), }; return(View(defaultModel)); }
public MainWindow() { InitializeComponent(); lessonTimeViewModel = new LessonTimeViewModel(database); studyGroupViewModel = new StudyGroupViewModel(database); lessonViewModel = new LessonViewModel(database); classroomViewModel = new ClassroomViewModel(database); teacherViewModel = new TeacherViewModel(database); scheduleViewModel = new ScheduleViewModel(database); changeViewModel = new ChangeViewModel(database); lvSchedule.DataContext = scheduleViewModel; cbsLessonTime.DataContext = lessonTimeViewModel; cbsStudyGroup.DataContext = studyGroupViewModel; cbsLesson.DataContext = lessonViewModel; cbsClassroom.DataContext = classroomViewModel; cbsTeacher.DataContext = teacherViewModel; lvChanges.DataContext = changeViewModel; cbcLessonTime.DataContext = lessonTimeViewModel; cbcStudyGroup.DataContext = studyGroupViewModel; cbcLesson.DataContext = lessonViewModel; cbcClassroom.DataContext = classroomViewModel; cbcTeacher.DataContext = teacherViewModel; SettingsDescriptions(); }
private void StartButton_Click(object sender, RoutedEventArgs e) { MissionType type = new MissionType(); Mission mission = new Mission(); Resource res = new Resource(); float progress = 0; missionRepo.GetAllMissions().ForEach(m => { if (missionsListBox.SelectedItem != null) { if (m.MissionName == missionsListBox.SelectedItem.ToString()) { type = m.MissionType; mission = m; } } }); pausedRepo.GetAllMissions().ForEach(pM => { if (mission.Id == pM.MissionId) { progress = pM.Progress; pausedRepo.DeleteMission(pM.Id); } }); if (resourcesListBox.SelectedItem != null) { string str = resourcesListBox.SelectedValue.ToString(); resourceRepo.GetAllResources().ForEach(r => { if (r.ResourceName == str) { res = r; } }); } ViewModel?.StopMission(); ViewModel = new DefaultViewModel(); /*------Добавление нового типа------*/ if (type.GetType() == typeof(ExcavationType)) { DataContext = ViewModel = new ExcavationVIewModel(progress, mission, res); } else if (type.GetType() == typeof(SurvivalType)) { DataContext = ViewModel = new SurvivalViewModel(progress, mission, res); } else { DataContext = ViewModel = new DefaultViewModel(); } /*----------------------------------*/ ViewModel.onMissionStop += onMissionStopHandler; ViewModel.StartMission(); }
public Default() { InitializeComponent(); BindingContext = new DefaultViewModel(this, Navigation); //var tgr = new TapGestureRecognizer(); //tgr.SetBinding<DefaultViewModel>(TapGestureRecognizer.CommandProperty, ViewModel => ViewModel.LoginInCommand); }
public ActionResult Default() { var model = new DefaultViewModel { Navigation = _accordionMenuItemProvider.GetMenu() }; return View(model); }
public MainViewModel(HomeViewModel homeViewModel , AccountViewModel accountViewModel , DefaultViewModel defaultViewModel) { _homeViewModel = homeViewModel; _reservationViewModel = _historyViewModel = defaultViewModel; _accountViewModel = accountViewModel; }
private async void getData() { var cpDataGroups = await LayoutDataSource.GetGroupsAsync(); foreach (LayoutDataGroup c in cpDataGroups) { DefaultViewModel.Add(c); } }
public ActionResult SearchPro(string searchText) { var defaultModel = new DefaultViewModel { ProImage = db.ProductImage.Where(pr => pr.baseImg == 1 && pr.Product.SubCategory.Name.Contains(searchText)).Take(10).ToList(), }; return(View(defaultModel)); }
public ActionResult Contact() { var defaultModel = new DefaultViewModel { contactTech = db.Contact.Find(1) }; return(View(defaultModel)); }
public ActionResult About() { var defaultModel = new DefaultViewModel { aboutTech = db.AboutUs.Find(1) }; return(View(defaultModel)); }
public ActionResult Index() { var defaultViewModel = new DefaultViewModel { Concerts = _eventsBuilder.Getevents(), Calendar = _calendarBuilder.GetCalendar() }; return(View("Index", defaultViewModel)); }
// GET: Product public ActionResult Product() { var defaultModel = new DefaultViewModel { CategoryName = db.Category.ToList(), SubCategoryName = db.SubCategory.ToList() }; return(View()); }
public IActionResult EvidentirajVoziloForm() { List <Kategorija> kategorije = reposKategorije.GetAll(); /*baza.Kategorije.ToList();*/ DefaultViewModel kategorijeVM = new DefaultViewModel() { Kategorije = kategorije }; return(View(kategorijeVM)); }
public IActionResult PrikaziRaspored() { List <RasporedCasova> raspored = reposRaspored.GetAll();/*RasporedCasova.Include(m => m.Kandidat).ToList();*/ DefaultViewModel rasporedVM = new DefaultViewModel { RasporedCasovaLista = raspored }; return(View(rasporedVM)); }
public ActionResult AttorneyInfo() { var defaultModel = new DefaultViewModel { attorneySingle = db.AttorneyTBs.Where(x => x.LanguageTB.CultureCode == mainLanguage.lb).SingleOrDefault(), basicInfo = db.BasicInfoes.First() }; return(View(defaultModel)); }
public ActionResult Index() { var defaultModel = new DefaultViewModel { topSilder = db.TopSliders.Where(x => x.LanguageTB.CultureCode == MainLanguage.lb).ToList(), aboutUS = db.AboutUsTBs.Where(x => x.LanguageTB.CultureCode == MainLanguage.lb).FirstOrDefault() }; return(View(defaultModel)); }
public IActionResult PrikaziKategorije() { List <Kategorija> kategorije = repo.GetAll(); var viewModel = new DefaultViewModel { Kategorije = kategorije }; return(View(viewModel)); }
public ActionResult Online() { var defaultModel = new DefaultViewModel { Category = db.Categories.ToList(), productList = db.Products.ToList(), SubCategory = db.SubCategories.ToList(), }; return(View(defaultModel)); }
// GET: Settings/Default public ActionResult Index() { var viewModel = new DefaultViewModel { Accounts = accountService.GetAll(), Currencies = currencyService.GetAll(), Taxs = taxService.GetAll() }; return(View(viewModel)); }
public ActionResult DefaultViewForm(DefaultViewModel model, FormCollection formCollection) { string defaultView = Request.Form.Get("views"); db db = new db(); db.singleItemUpdateAsync("AspNetUsers", "DefaultView='" + defaultView + "'", "UserName='******'"); Session["tempforview"] = "View: " + defaultView + " has been successfully chosen."; return(RedirectToAction("DefaultView", "Manage")); }
public ActionResult Index() { ViewBag.UsersCount = db.Users.Count(); ViewBag.OrdersCount = db.Orders.Count(); var defaultModel = new DefaultViewModel { OrderList = db.Orders.ToList(), }; return(View(defaultModel)); }
/// <summary> /// Indexes this instance. /// </summary> /// <returns></returns> public ActionResult Index() { var viewModel = new DefaultViewModel<Page> { CurrentPage = _currentPage, NavigationContext = _structureInfo.NavigationContext }; ViewBag.Class = "page"; return View(viewModel); }
/// <summary> /// Indexes this instance. /// </summary> /// <returns></returns> public ActionResult Index() { var viewModel = new DefaultViewModel<Page> { CurrentPage = _currentPage, Pages = _structureInfo.Pages }; ViewBag.Class = "page"; return View(viewModel); }
/// <summary> /// Indexes this instance. /// </summary> /// <param name="currentPage">The current page.</param> /// <returns></returns> public ActionResult Index(Portfolio currentPage) { var viewModel = new DefaultViewModel<Portfolio> { CurrentPage = currentPage, Pages =_structureInfo.Pages }; ViewBag.Class = "portfolio"; return View(viewModel); }
/// <summary> /// Indexes this instance. /// </summary> /// <param name="currentPage">The current page.</param> /// <returns></returns> public ActionResult Index(Contact currentPage) { var viewModel = new DefaultViewModel<Contact> { CurrentPage = currentPage, NavigationContext = _structureInfo.NavigationContext }; ViewBag.Class = "contact"; return View(viewModel); }
/// <summary> /// Indexes this instance. /// </summary> /// <param name="currentPage">The current page.</param> /// <returns></returns> public ActionResult Index(Weblog currentPage) { var viewModel = new DefaultViewModel<Weblog> { CurrentPage = currentPage, NavigationContext = _structureInfo.NavigationContext }; ViewBag.Class = "weblog"; return View(viewModel); }