示例#1
0
        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));
        }
示例#2
0
        // 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));
        }
示例#3
0
        /// <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);
        }
示例#4
0
        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);
            }
        }
示例#5
0
 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();
 }
示例#6
0
        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));
            }
        }
示例#7
0
        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);
            }
        }
示例#8
0
        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));
            }
        }
示例#10
0
 /// <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();
     }
 }
示例#11
0
        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));
        }
示例#12
0
        // 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();
        }
示例#14
0
        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();
        }
示例#15
0
        public Default()
        {
            InitializeComponent();
            BindingContext = new DefaultViewModel(this, Navigation);

            //var tgr = new TapGestureRecognizer();
            //tgr.SetBinding<DefaultViewModel>(TapGestureRecognizer.CommandProperty, ViewModel => ViewModel.LoginInCommand);
        }
示例#16
0
 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;
 }
示例#18
0
        private async void getData()
        {
            var cpDataGroups = await LayoutDataSource.GetGroupsAsync();

            foreach (LayoutDataGroup c in cpDataGroups)
            {
                DefaultViewModel.Add(c);
            }
        }
示例#19
0
        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));
        }
示例#20
0
        public ActionResult Contact()
        {
            var defaultModel = new DefaultViewModel
            {
                contactTech = db.Contact.Find(1)
            };

            return(View(defaultModel));
        }
示例#21
0
        public ActionResult About()
        {
            var defaultModel = new DefaultViewModel
            {
                aboutTech = db.AboutUs.Find(1)
            };

            return(View(defaultModel));
        }
示例#22
0
        public ActionResult Index()
        {
            var defaultViewModel = new DefaultViewModel
            {
                Concerts = _eventsBuilder.Getevents(),
                Calendar = _calendarBuilder.GetCalendar()
            };

            return(View("Index", defaultViewModel));
        }
示例#23
0
        // GET: Product
        public ActionResult Product()
        {
            var defaultModel = new DefaultViewModel
            {
                CategoryName    = db.Category.ToList(),
                SubCategoryName = db.SubCategory.ToList()
            };

            return(View());
        }
示例#24
0
        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));
        }
示例#26
0
        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));
        }
示例#27
0
        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));
        }
示例#29
0
        public ActionResult Online()
        {
            var defaultModel = new DefaultViewModel
            {
                Category    = db.Categories.ToList(),
                productList = db.Products.ToList(),
                SubCategory = db.SubCategories.ToList(),
            };

            return(View(defaultModel));
        }
示例#30
0
        // GET: Settings/Default
        public ActionResult Index()
        {
            var viewModel = new DefaultViewModel
            {
                Accounts   = accountService.GetAll(),
                Currencies = currencyService.GetAll(),
                Taxs       = taxService.GetAll()
            };

            return(View(viewModel));
        }
示例#31
0
        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"));
        }
示例#32
0
        public ActionResult Index()
        {
            ViewBag.UsersCount  = db.Users.Count();
            ViewBag.OrdersCount = db.Orders.Count();
            var defaultModel = new DefaultViewModel
            {
                OrderList = db.Orders.ToList(),
            };

            return(View(defaultModel));
        }
示例#33
0
        /// <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);
        }
示例#34
0
        /// <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);
        }
示例#35
0
        /// <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);
        }
示例#36
0
        /// <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);
        }
示例#37
0
        /// <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);
        }