コード例 #1
0
ファイル: HomeController.cs プロジェクト: DionisiyG/GameShop
        public ActionResult Index(string id = null)
        {
            HomeIndexModel homeModel = new HomeIndexModel(categoryService);

            homeModel.Products = productService.GetMainProducts(id);// convert to
            return(View(homeModel));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: DionisiyG/GameShop
        public ActionResult GetDetails(string id)
        {
            HomeIndexModel homeModel = new HomeIndexModel(categoryService);

            homeModel.Products = productService.GetProductInfo(id);// convert to
            return(View(homeModel));
        }
コード例 #3
0
        public async Task <IActionResult> Set(HomeIndexModel model)
        {
            if (!this.ModelState.IsValid)
            {
                if (model == null)
                {
                    model = new HomeIndexModel();
                }
                this.SetModelData(model);
                return(this.View("Index", model));
            }
            if (model.File != null)
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    await model.File.CopyToAsync(ms);

                    await this.m_matrixManager.SetImage(ms.ToArray(), model.File.ContentType);
                }
            }
            await this.m_matrixManager.SetBrightness(model.Brightness);

            this.SetModelData(model);
            return(this.View("Index", model));
        }
コード例 #4
0
        //
        // GET: /Home/

        public ActionResult Index(string lang)
        {
            ActionResult result = null;

            if (!string.IsNullOrWhiteSpace(lang))
            {
                HomeIndexModel model = new HomeIndexModel();

                List <List <OggettoHome> > listeOggetti = OggettoHomeRepository.Instance.RecuperaOggettiHome();

                List <WidgetCorrelato> widget = new List <WidgetCorrelato>();

                widget = WidgetCorrelatoRepository.Instance.RecuperaWidgetCorrelati(1);

                model.Widget = widget;

                model.Oggetti = listeOggetti[0];

                result = View(model);
            }
            else
            {
                result = RedirectToRoutePermanent("Home_Index", new { lang = "it-IT" });
            }


            return(result);
        }
コード例 #5
0
        public ActionResult LocationChange(LocationChangeModel _LocationChangeModel)
        {
            HomeIndexModel _HomeIndexModel = new HomeIndexModel();

            _HomeIndexModel.Locations = repository.GetLocations().ToList();
            var           currentUser    = idb.Users.Find(User.Identity.GetUserId());
            CultureHelper _CultureHelper = new CultureHelper(repository);

            //Check that user ID is a current location ID
            if (_HomeIndexModel.Locations.Any(l => l.id == _LocationChangeModel.LocationsId))
            {
                currentUser.LocationID = repository.GetLocations().Where(l => l.id == _LocationChangeModel.LocationsId).Select(o => o.id).FirstOrDefault();
                idb.SaveChanges();
                Location     _Location = repository.GetLocations().Where(l => l.id == currentUser.LocationID).FirstOrDefault();
                TimeZoneInfo TZone     = _CultureHelper.GetTimeZoneInfo(currentUser.LocationID);
                _HomeIndexModel.LocationsId         = _Location.id;
                _HomeIndexModel.CurrentUserLocation = _Location.Name;
            }
            else
            {
                TimeZoneInfo TZone     = _CultureHelper.GetTimeZoneInfo(currentUser.LocationID);
                Location     _Location = repository.GetLocations().Where(l => l.id == currentUser.LocationID).FirstOrDefault();
                _HomeIndexModel.LocationsId         = _Location.id;
                _HomeIndexModel.CurrentUserLocation = _Location.Name;
            }

            return(View("Index", _HomeIndexModel));
        }
コード例 #6
0
        // GET: /Index

        public ActionResult Index(string keywords = "", string user = "")
        {
            var m = new HomeIndexModel();

            using (var db = new TTDBEntities())
            {
                IEnumerable <Item> result = db.Item;
                m.items = Item2ItemModel(SearchWithInput(keywords, result));
            }

            ViewBag.searchInput = keywords;
            /************************************************************************/
            /* for test                                                             */
            /* add login                                                            */
            /************************************************************************/
            if (user != "")
            {
                m.account = new AccountModel()
                {
                    screenName    = user,
                    isLandingPage = false,
                    isLogedIn     = true
                };
            }
            else
            {
                m.account = new AccountModel()
                {
                    isLandingPage = false
                };
            }

            return(View(m));
        }
コード例 #7
0
        // GET: Home
        public ActionResult Index()
        {
            using (MyDBContext ctx = new MyDBContext())
            {
                ////添加基础数据
                //MinZu mz = new MinZu() { Name = "汉族" };
                //ctx.Set<MinZu>().Add(mz);
                //Class c1 = new Class() { Name = "三年级二班" };
                //Student s1 = new Student() { Name = "Jacky", Age = 8,Class=c1,MinZu=mz };
                //Student s2 = new Student() { Name = "Tom", Age = 9,Class=c1,MinZu=mz };
                //ctx.Classes.Add(c1);
                //ctx.Students.Add(s1);
                //ctx.Students.Add(s2);
                //ctx.SaveChanges();

                //遍历查询班级学生信息
                var            c1      = ctx.Classes.First();
                var            stu     = ctx.Students.Where(s => s.Class.Id == c1.Id).ToList();
                HomeIndexModel HiModel = new HomeIndexModel();
                HiModel.Class    = c1;
                HiModel.Students = stu;
                return(View(HiModel));
            }

            //return Content("数据添加成功");
        }
コード例 #8
0
ファイル: HomeController.cs プロジェクト: WhiteIsland/epiworx
        public ActionResult Index(string dashboard)
        {
            var model = new HomeIndexModel();

            model.Tab       = "Home";
            model.Dashboard = dashboard ?? "My";
            model.StartDate = DateTime.Today.ToStartOfWeek();
            model.EndDate   = DateTime.Today.ToEndOfWeek();

            if (model.Dashboard == "Team")
            {
                model.Tasks = TaskService.TaskFetchInfoList(
                    new TaskCriteria
                {
                    IsArchived = false
                });
                model.Hours = HourService.HourFetchInfoList(model.StartDate, model.EndDate);
                model.Feeds = FeedService.FeedFetchInfoList(5);
            }
            else
            {
                model.Tasks = MyService.TaskFetchInfoList();
                model.Hours = MyService.HourFetchInfoList(model.StartDate, model.EndDate);
                model.Feeds = MyService.FeedFetchInfoList(5);
            }

            return(this.View(model));
        }
コード例 #9
0
        public ActionResult Index(int?page, int typeId = 0)
        {
            DataEntities db           = new DataEntities();
            var          pageNumber   = page ?? 1;
            var          itemsPerPage = 9;
            var          items        = db.Items.OrderByDescending(i => i.ItemId);

            if (typeId != 0)
            {
                var selectedType = db.Types.Find(typeId);
                if (selectedType != null)
                {
                    items = db.Items.Where(i => i.TypeId == typeId).OrderByDescending(i => i.ItemId);
                }
                else
                {
                    return(View("Error"));
                }
            }
            var typeList  = new SelectList(db.Types, "TypeId", "Name");
            var itemModel = new HomeIndexModel
            {
                TypeId       = typeId,
                Items        = items.ToPagedList(pageNumber, itemsPerPage),
                LastestItems = items.Take(5)
            };

            return(View(itemModel));
        }
コード例 #10
0
        public ActionResult Search(HomeIndexModel model)
        {
            if (!ModelState.IsValid)
            {
                model.SelectedLogDatabase = GetSelectedConnectionStringName();
                model.OutputRowCount      = GetTopValue();
                model.LogDatabases.AddRange(LogDatabaseConnectionStrings.Select(css => new SelectListItem
                {
                    Text  = css.Name.Replace(LogDatabase.ConnectionStringPrefix, string.Empty),
                    Value = css.Name,
                }));

                return(View("Index", model));
            }

            var profiler = MiniProfiler.Current;

            using (profiler.Step("Getting logs from database"))
                using (var sqlConn = CreateProfiledDbConnection())
                {
                    var searchTerm = "%" + model.SearchTerm.Replace("%", "[%]").Replace("[", "[[]").Replace("]", "[]]") + "%";
                    model.Logs.AddRange(sqlConn.Query <Log>(GetSearchSql(GetTopValue()),
                                                            new { searchTerm }));
                }

            model.SelectedLogDatabase = GetSelectedConnectionStringName();
            model.OutputRowCount      = GetTopValue();
            model.LogDatabases.AddRange(LogDatabaseConnectionStrings.Select(css => new SelectListItem
            {
                Text  = css.Name.Replace(LogDatabase.ConnectionStringPrefix, string.Empty),
                Value = css.Name,
            }));

            return(View("Index", model));
        }
コード例 #11
0
        /// <summary>
        /// Обработчик главной страницы
        /// </summary>
        public async Task <IActionResult> Index()
        {
            var model = new HomeIndexModel()
            {
                AvailableGames = GamePackage.ListAvailable()
                                 .Select(pkg => GameInfo.FromGamePackage(pkg))
                                 .ToList(),
                ActiveSessions = sessionsManager.GetSessions()
                                 .Select(s => SessionInfo.FromGameSession(s))
                                 .OrderBy(si => si.StartedAt)
                                 .ToList()
            };

            if (model.IsSigned)
            {
                try
                {
                    var playerSession = userCtx.GetGameSession();
                    model.PlayerSession = SessionInfo.FromGameSession(playerSession);
                    model.IsSigned      = true;
                }
                catch (NullReferenceException)
                {
                    await userCtx.PerformLogout();
                }
            }

            return(View(model));
        }
コード例 #12
0
        public IActionResult Index()
        {
            var List1 = _IProductService.getAll().Select(p => new HomeProductListingModel {
                Id          = p.Id,
                CategoryId  = p.CategoryId,
                Description = p.Description,
                Name        = p.Name,
                Picture     = p.Picture,
                Price       = p.Price
            });

            var List2 = _ICategoryService.getAll().Select(cat => new HomeCategoryListingModel {
                CategoryId = cat.CategoryId,
                Name       = cat.Name
            });

            var list3 = _IComponentService.getAll().Select(comp => new HomeComponentsListingModel {
                ComponentId  = comp.ComponentId,
                ComponentUrl = comp.ComponentUrl,
                ProductId    = comp.ProductId
            });


            var model = new HomeIndexModel {
                ProductListing   = List1,
                CategoryListing  = List2,
                ComponentListing = list3
            };


            return(View(model));
        }
コード例 #13
0
        public ActionResult Index()
        {
            var model = new HomeIndexModel();

            model.LatestArticles = this.Blogservice.GetLatest <LatestArticlesDto>(3);

            return(View(model));
        }
コード例 #14
0
        public IActionResult Index()
        {
            HomeIndexModel model = new HomeIndexModel()
            {
                Brightness = this.m_matrixManager.Brightness,
            };

            return(this.View(model));
        }
コード例 #15
0
 public HomeController(
     SignInManager <User> signInManager, ILogger <HomeController> logger, IUserBlProvider userBlProvider, IConfiguration cfg) : base(cfg, userBlProvider)
 {
     _signInManager  = signInManager;
     _logger         = logger;
     _userBlProvider = userBlProvider;
     _cfg            = cfg;
     IndexModel      = new HomeIndexModel();
 }
コード例 #16
0
        public ActionResult Index()
        {
            var posts     = _blogPostRepository.GetAll().Where(o => o.Published);
            var viewModel = new HomeIndexModel {
                Posts = posts.OrderByDescending(o => o.DateCreated).Select(Mapper.Map)
            };

            return(View(viewModel));
        }
コード例 #17
0
        public ActionResult Index()
        {
            var model = new HomeIndexModel()
            {
                Users = userRepository.GetAll()
            };

            return(View(model));
        }
コード例 #18
0
        // GET: /Home/
        public ActionResult Index()
        {
            HomeIndexModel model  = new HomeIndexModel();
            Utente         utente = MembershipUtils.RecuperaUtenteCorrente();

            model.Utente = utente;

            return(View(model));
        }
コード例 #19
0
        public ActionResult CreateBook(HomeIndexModel model)
        {
            var id = _bookService.CreateBook(new Book
            {
                Title = model.Title
            });

            return(Redirect("/"));
        }
コード例 #20
0
        public ActionResult Index(HomeIndexModel model)
        {
            if (IsConnectionStringInWebConfig(model.SelectedLogDatabase))
            {
                SetConnectionStringCookie(model.SelectedLogDatabase);
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
コード例 #21
0
        public IActionResult Index()
        {
            HomeIndexModel model = new HomeIndexModel()
            {
                Apps      = AppSvc.LoadApps().ToList(),
                Exchanges = TopicSvc.LoadExchanges().ToList()
            };

            return(View(model));
        }
コード例 #22
0
        public async Task <ActionResult> Index()
        {
            var model = new HomeIndexModel();


            // Code Here


            return(View(model));
        }
コード例 #23
0
        public IActionResult Index2()
        {
            var dal   = new AdministratorDal();
            var model = new HomeIndexModel()
            {
                Count = dal.Query().Count,
            };

            return(View(model));
        }
コード例 #24
0
        public async Task <IActionResult> Index()
        {
            var model = new HomeIndexModel()
            {
                Setting = await _settingService.GetListSettingList(SettingType.Homepage),
                Slider  = await _settingService.GetAllSlider()
            };

            return(View(model));
        }
コード例 #25
0
        public ActionResult Index()
        {
            var            bestbooks = db.Books.Where(b => b.Category.GroupId == 1).ToList();
            HomeIndexModel model     = new HomeIndexModel()
            {
                LastBooks = db.Books.ToList().Skip(db.Books.Count() - 16).Take(16).Reverse().ToList(), BestBooks = bestbooks, Carousels = db.CarouselNews.ToList().GetRange(db.CarouselNews.Count() - 3, 3)
            };

            return(View(model));
        }
        public async Task <IActionResult> Index()
        {
            var model = new HomeIndexModel();

            if (User.Identity.IsAuthenticated)
            {
                model.Employees = await GetEmployeeData();
            }

            return(View(model));
        }
コード例 #27
0
        public ActionResult Index(HomeIndexModel model)
        {
            if (IsConnectionStringInWebConfig(model.SelectedLogDatabase))
            {
                SetConnectionStringCookie(model.SelectedLogDatabase);

                return RedirectToAction("Index");
            }

            return View(model);
        }
コード例 #28
0
        public IActionResult Index()
        {
            HomeIndexModel model = new HomeIndexModel();

            model.Autocomplete = new AutocompleteModel
            {
                Id = "ddlSearch"
            };

            return(View(model));
        }
コード例 #29
0
        public IActionResult Index(HomeIndexModel homeModel, CourseIndexModel coursesModel, RegisterModel registerModel)
        {
            var model = new SchoolBoard.Models.HelperModels.HomeShared
            {
                HomeIndexModel = homeModel,
                MyCoursesModel = coursesModel,
                RegisterModel  = registerModel
            };

            return(View(model));
        }
コード例 #30
0
        public async Task <IActionResult> Index()
        {
            var eventList = await _dataService.GetAllEvents();

            var model = new HomeIndexModel
            {
                EventList = eventList.Select(x => _dataMapper.Map(x))
            };

            return(View(model));
        }
コード例 #31
0
        public async Task <ActionResult> Index()
        {
            var model = new HomeIndexModel();

            var videoRepo = VideoRepositoryFactory.Create();

            model.Videos = from c in await videoRepo.GetAll()
                           orderby c.Title, c.Created
            select c;

            return(View(model));
        }
コード例 #32
0
        public async Task<ActionResult> Index()
        {
            var model = new HomeIndexModel();

            using (MiniProfiler.Current.Step("Getting logs from database"))
            using (var conn = CreateProfiledDbConnection())
            {
                model.Logs.AddRange(
                    await conn
                        .QueryAsync<Log>(DapperQueries.GetTop100Logs)
                    );
            }

            model.SelectedLogDatabase = GetSelectedConnectionStringName();

            var dbConnStrings = LogDatabaseConnectionStrings
                .Select(css => new SelectListItem { Text = css.Name.ToFriendlyLogDatabaseName(), Value = css.Name });
            model.LogDatabases.AddRange(dbConnStrings);

            return View(model);
        }
コード例 #33
0
ファイル: HomeController.cs プロジェクト: jarrettv/Feedback
        public ActionResult Index()
        {
            var m = new HomeIndexModel();
            var fewHoursAgo = DateTime.Now.AddHours(-2);
            m.CurrentPresentation = db.Presentations
                .Where(x => x.Date >= fewHoursAgo)
                .OrderBy(x => x.Date)
                .FirstOrDefault();

            m.UpcomingPresentations = db.Presentations
                .Where(x => x.Date > DateTime.Now)
                .OrderBy(x => x.Date)
                .Take(5)
                .ToArray();

            m.RecentPresentations = db.Presentations
                .Where(x => x.Date < DateTime.Now)
                .OrderByDescending(x => x.Date)
                .Take(5)
                .ToArray();
            return this.View(m);
        }
コード例 #34
0
        public ActionResult Index()
        {
            var listContentItems = this.contentItemRepository.GetTopWithActive(GlobalSettings.DefaultPageSize);
            var listItems = FrameworkExtensions.ConvertAll<ContentItemModel, ContentItem>(listContentItems, true);

            var focusItems = this.contentItemRepository.GetTopWithActiveByViews(GlobalSettings.FocusItemSize);
            var focusModels = FrameworkExtensions.ConvertAll<ContentItemModel, ContentItem>(focusItems, true);

            HomeIndexModel model = new HomeIndexModel()
            {
                NewItems = listItems,
                FocusItems = focusModels,
            };
            model.PageMeta.Description = "";
            model.PageMeta.Author = FrameworkServices.Translation.GetByKeyword("GUI.Common.SiteAuthor");
            model.PageMeta.Keywords = FrameworkServices.Translation.GetByKeyword("GUI.Page.Home.Keywords");

            return base.View(model);
        }