示例#1
0
        public ActionResult Index()
        {
            var model = new HomeIndexViewModel
                        {
                            Categories = _session.Query<Category>().Where(c => c.ParentCategory == null).ToList()
                        };

            return View(model);
        }
        public ActionResult Index()
        {
            var viewModel = new HomeIndexViewModel
            {
                Status = context.Status.ToList()
            };

            return View(viewModel);
        }
示例#3
0
        // GET: /
        public async Task<ViewResult> Index()
        {
            //var languageCode = Thread.CurrentThread.CurrentUICulture.Name.ToLower();
            var homePage = await this.pageService.GetPageAsync(1);

            var model = new HomeIndexViewModel
            {
                Page = homePage.Page
            };

            return View(model);
        }
示例#4
0
        public ActionResult Index()
        {
            var viewModel = new HomeIndexViewModel
            {
                Doctors        = _context.DoctorDepartments.Include(d => d.Department).Include(d => d.DoctorUser).Take(4).ToList(),
                Departments    = _context.Departments.Take(4).ToList(),
                BlogPosts      = _context.Blogs.Take(2).ToList(),
                Testimonials   = _context.Testimonials.Take(2).ToList(),
                ProbableEvents = _context.Events.Take(4).ToList()
            };

            return(View(viewModel));
        }
示例#5
0
        public ActionResult Index()
        {
            using (var ctx = new LunchContext())
            {
                var today = DateTime.Now.Date;
                var user  = ctx.Users.SingleOrDefault(u => u.EmailAddress == User.Identity.Name);

                var model = new HomeIndexViewModel {
                    DictatorshipViewModels = new List <HomeIndexDictatorshipViewModel>()
                };

                foreach (var dictatorship in user.Dictatorships)
                {
                    var places            = ctx.Places.Where(p => p.Dictatorship.Id == dictatorship.Id).ToList();
                    var dictatorshipModel = new HomeIndexDictatorshipViewModel()
                    {
                        Id     = dictatorship.Id,
                        Name   = dictatorship.Name,
                        Places =
                            places.Select(p => new PlaceViewModel {
                            ImageUrl = p.ImageUrl, Name = p.Name, Id = p.Id
                        })
                            .ToList()
                    };

                    if (dictatorshipModel.Places.Any())
                    {
                        var selection = ctx.PlaceSelections.SingleOrDefault(s => s.Date == today && s.Place.Dictatorship.Id == dictatorship.Id);

                        if (selection == null)
                        {
                            var rand = new Random();
                            selection = new PlaceSelection {
                                Date = today, Place = places[rand.Next(places.Count)]
                            };
                            ctx.PlaceSelections.Add(selection);

                            ctx.SaveChanges();
                        }

                        var selectedPlace = dictatorshipModel.Places.Single(p => p.Id == selection.Place.Id);
                        selectedPlace.IsSelected        = true;
                        dictatorshipModel.SelectedPlace = selectedPlace.Name;
                    }

                    model.DictatorshipViewModels.Add(dictatorshipModel);
                }

                return(this.View(model));
            }
        }
示例#6
0
        public ActionResult Index()
        {
            List <News> newlist = new NewsServices().GetNews();

            List <Category> categorylist = new CategoryServices().GetCategories();

            var model = new HomeIndexViewModel
            {
                Categories = categorylist,
                News       = newlist
            };

            return(View(model));
        }
        public IActionResult GetView(int id)
        {
            ViewData["Categories"] = _context.Categories.ToList();
            //string CategoyName, SubCatName = string.Empty;
            ViewBag.CatName = _context.Categories.Where(c => c.CategoryKey == id).FirstOrDefault().CategoryName;

            ViewBag.SubCat = _context.SubCategories.Where(s => s.CategoryKey == id).FirstOrDefault().Subcategory;
            var menuList             = new List <MenuItem>();
            HomeIndexViewModel model = new HomeIndexViewModel();

            menuList        = _context.MenuItem.Where(m => m.CategoryKey == id).ToList();
            model.MenuItems = menuList;
            return(View("~/Views/Home/ChildMenu.cshtml", menuList));
        }
        public async Task <IActionResult> Index()
        {
            HomeIndexViewModel model = new HomeIndexViewModel();

            model.Categories = await _context.Categories.ToListAsync();

            model.Coupons = await _context.Coupon.ToListAsync();

            model.subCategories = await _context.SubCategories.ToListAsync();

            model.MenuItems = await _context.MenuItem.ToListAsync();

            return(View(model));
        }
示例#9
0
 public ActionResult SendMessage(int?id, string pageTitle, HomeIndexViewModel model, Message message, bool userMode = false)
 {
     ViewBag.Service = _service;
     _service.SendMessage(message);
     if (message.IsReview)
     {
         TempData["message"] = "Thanks for your review!!";
     }
     else
     {
         TempData["message"] = "Your message has been sent";
     }
     return(RedirectToAction("Index", new { id = id }));
 }
示例#10
0
        public IActionResult Index()
        {
            var model = new HomeIndexViewModel();

            model.Restaurants    = _restaurantData.GetAll();
            model.CurrentMessage = _greeter.GetMessageOfTheDay();

            //returning json
            //return new ObjectResult(model);



            return(View(model));
        }
示例#11
0
        public async Task <IActionResult> Index()
        {
            var model = new HomeIndexViewModel
            {
                Slider             = _db.Books.OrderByDescending(b => b.CreatedAt).Take(10),
                MostCommentedBooks = _db.Books.OrderByDescending(b => b.Comments.Count).Take(4),
                MostFavoriteBooks  = _db.Books.OrderByDescending(b => b.Favorites.Count).Take(4),
                MostViewedBooks    = _db.Books.OrderByDescending(b => b.ViewCount).Take(4),
                MostRatedBooks     = _db.Books.OrderByDescending(b => b.Rating.Count).Take(4),
                Banner             = await _db.Banners.FirstOrDefaultAsync()
            };

            return(View(model));
        }
示例#12
0
        public async Task <ActionResult> Index()
        {
            var latestPostsDb = await this.postsService.GetLatestPosts(10);

            var latestPosts = latestPostsDb.Select(post =>
                                                   new PostViewModel(post, post.ApplicationUser, post.PostReplies, post.Forum));
            var model = new HomeIndexViewModel
            {
                SearchQuery = "",
                LatestPosts = latestPosts,
            };

            return(View(model));
        }
示例#13
0
 public ActionResult Search_Post(HomeIndexViewModel model)
 {
     ViewBag.Title = "Index";
     if (!String.IsNullOrWhiteSpace(model.SearchString))
     {
         JoinWithBaseModel(model);
         //var userId = userService.GetUserByUserSpaceId(Int32.Parse(model.CurrentPageSpaceId)).Id;
         var searchlist        = imageService.SearchWithAvatars(model.SearchString);
         var imagesWithAvatars = MapImagesWithAvatarsResults(searchlist);
         model.ImagesWithAvatars = imagesWithAvatars;
         return(PartialView("_Images", model));
     }
     return(PartialView("Error", model));
 }
示例#14
0
        public ActionResult Index()
        {
            //получение номеров автобусов
            var buses = repository.GetBuses();

            HomeIndexViewModel model = new HomeIndexViewModel {
                busNumber = buses,
                stopName  = new List <string>(),
                endStop   = new List <string>(),
                days      = new List <string>()
            };

            return(View(model));
        }
        public IActionResult index()
        {
            // return Content("This is the home page ~ Hello from the home controller");
            var model = new HomeIndexViewModel()
            {
                Restaurants    = this._restaurantData.GetAll(),
                CurrentMessage = _greeter.GetMessageOfTheDay()
            };

            // The return type of this object is defined in the pipeline, the default is json
            // Search for: Content Negotiation
            //return new ObjectResult(model);
            return(View(model));
        }
        // Populate a new HomeIndexViewModel instance to Home/Index view
        public ActionResult Index(string searchKeyword)
        {
            // Search:
            if (!String.IsNullOrEmpty(searchKeyword))
            {
                return(RedirectToAction("Search", "Books", new { keyword = searchKeyword }));
            }

            var homeIndexVM = new HomeIndexViewModel();

            homeIndexVM.FullSetUp(db);

            return(View(homeIndexVM));
        }
示例#17
0
        public IActionResult Index()
        {
            HomeIndexViewModel model    = new HomeIndexViewModel();
            List <Product>     products = _db.Products.OrderBy(product => product.Stock).Where(product => product.ReleaseDate.CompareTo(DateTime.Now) <= 0).Take(15).ToList();

            products.ForEach(product => product.Images = _db.Images.Where(image => image.ProductId == product.Id).OrderBy(image => image.Order).Take(1).ToList());
            model.products = products;

            model.advertisements = _db.Advertisements.Where(advt => advt.StartDate.CompareTo(DateTime.Now) <= 0 && advt.EndDate.CompareTo(DateTime.Now) > 0).OrderBy(advt => advt.StartDate).ToList();

            model.categories = _db.Categories.OrderBy(category => category.Id).ToList();

            return(View(model: model));
        }
示例#18
0
        // GET: Home
        public virtual ActionResult Index()
        {
            var model = new HomeIndexViewModel();

            //model.Groups = _groupService.GetAll();

            //model.SlideShows = _slideShowService.List();
            //model.NewProducts = _productService.GetMoreSellProduct(6);
            //model.BestSellerProducts = _productService.GetMoreSellProduct(6);
            //model.PopularProducts = _productService.GetMoreSellProduct(6);


            return(View(model));
        }
示例#19
0
        public IActionResult Index()
        {
            var model = new HomeIndexViewModel
            {
                VisitorCount = (new Random()).Next(1, 1001),
                Categories   = db.Categories.ToList(),
                Products     = db.Products.ToList()
            };

            // When View() is called,
            // MVC looks in the `Views` folder for a subfolder with the same name as the current controller
            // It then looks for a file with the same name as the current action
            return(View(model));
        }
示例#20
0
        public IActionResult Index()
        {
            var model = new HomeIndexViewModel();

            model.Restaurants    = _restaurantData.GetAll();
            model.CurrentMessage = _greeter.GetMessageOftheDay();

            //returns object in json
            //return new ObjectResult(model);

            return(View(model));

            //return Content("Hello from the Home Controller");
        }
示例#21
0
        public ActionResult Index1()
        {
            var note  = notes.GetHotNote(8);
            var video = videos.GetHotVideo(6);
            var hgood = goods.GetHotGoods(3);
            var ngood = goods.GetNewGoods(6);
            HomeIndexViewModel homeindexviewmodel = new HomeIndexViewModel();

            homeindexviewmodel.notes    = note;
            homeindexviewmodel.videos   = video;
            homeindexviewmodel.hotgoods = hgood;
            homeindexviewmodel.newgoods = ngood;
            return(View(homeindexviewmodel));
        }
示例#22
0
        public ActionResult Index()
        {
            var model = new HomeIndexViewModel();

            model.Videos = db.Videos.Include(v => v.Copies).ToList()
                           .Select(v => new VideoFrontPageViewModel
            {
                AvailableCopies = v.Copies.Where(c => c.RentedDate == null).Count(),
                ID    = v.ID,
                Title = v.Title
            }).ToList();

            return(View(model));
        }
示例#23
0
        public ActionResult Index()
        {
            HomeIndexViewModel model = null;

            if (ClaimsPrincipal.Current.Identity.IsAuthenticated)
            {
                model = new HomeIndexViewModel();
                model.UserOrganizations = new Dictionary <string, Organization>();
                model.UserSubscriptions = new Dictionary <string, Subscription>();
                model.UserCanManageAccessForSubscriptions = new List <string>();
                model.DisconnectedUserOrganizations       = new List <string>();

                var orgnaizations = AzureResourceManagerUtil.GetUserOrganizations();
                foreach (Organization org in orgnaizations)
                {
                    model.UserOrganizations.Add(org.Id, org);
                    var subscriptions = AzureResourceManagerUtil.GetUserSubscriptions(org.Id);

                    if (subscriptions != null)
                    {
                        foreach (var subscription in subscriptions)
                        {
                            Subscription s = db.Subscriptions.Find(subscription.Id);
                            if (s != null)
                            {
                                subscription.IsConnected = true;
                                subscription.ConnectedOn = s.ConnectedOn;
                                subscription.ConnectedBy = s.ConnectedBy;
                                subscription.AzureAccessNeedsToBeRepaired = !AzureResourceManagerUtil.ServicePrincipalHasReadAccessToSubscription(subscription.Id, org.Id);
                            }
                            else
                            {
                                subscription.IsConnected = false;
                            }

                            model.UserSubscriptions.Add(subscription.Id, subscription);
                            if (AzureResourceManagerUtil.UserCanManageAccessForSubscription(subscription.Id, org.Id))
                            {
                                model.UserCanManageAccessForSubscriptions.Add(subscription.Id);
                            }
                        }
                    }
                    else
                    {
                        model.DisconnectedUserOrganizations.Add(org.Id);
                    }
                }
            }
            return(View(model));
        }
示例#24
0
        public ActionResult Index(IngredientsViewModel IngVm, string q, int?cid, string slug, int page = 1)
        {
            var pageSize = 10;
            IQueryable <Recipe> recipes  = db.Recipes;
            Category            category = null;
            var ingredients = db.Ingredients.Select(x => new
            {
                IngredientId   = x.Id,
                IngredientName = x.IngredientName
            });

            ViewBag.Ingredients = new MultiSelectList(ingredients.ToList(), "IngredientId", "IngredientName");
            if (IngVm.IngredientId != null)
            {
                TempData["DropBoxBosalt"] = true;
                var selectedIngredients = new List <Ingredient>();
                foreach (var item in IngVm.IngredientId)
                {
                    selectedIngredients.Add(db.Ingredients.FirstOrDefault(x => x.Id == item));
                }
                foreach (var item in selectedIngredients)
                {
                    recipes = recipes.Where(x => x.Ingredients.Where(y => y.Id == item.Id).Any());
                }
            }
            if (q != null)
            {
                recipes = recipes.Where(x => x.Category.CategoryName.Contains(q) ||
                                        x.Title.Contains(q));
            }
            if (cid != null && q == null)
            {
                category = db.Categories.Find(cid);
                if (category == null)
                {
                    return(HttpNotFound());
                }

                recipes = recipes.Where(x => x.CategoryId == cid);
            }
            var vm = new HomeIndexViewModel
            {
                Recipes    = recipes.OrderByDescending(x => x.CreationTime).ToPagedList(page, pageSize),
                Category   = category,
                SearchTerm = q,
                CategoryId = cid
            };

            return(View(vm));
        }
示例#25
0
        public IActionResult Index()
        {
            var model = new HomeIndexViewModel();

            model.CookingRecipesModel         = new CookingRecipesViewModel();
            model.CookingRecipesModel.Recipes = cookingRecipeService
                                                .GetAllRecipesAsPublic()
                                                .Where(recipe => recipe.CoverImageFileName != null).Take(3).ToList();

            model.Cloudinary = this.cloudinaryService.GetCloudinaryInstance();
            model.InspirationImageFileName = this.inspirationRepository.GetInspirationImage();

            return(View(model));
        }
示例#26
0
        public IActionResult Index(String zipCode = null)
        {
            zipCode = zipCode ?? "60605";

            OpenWeatherApiClient client = new OpenWeatherApiClient();
            var response = client.GetWeather(zipCode);

            var model = new HomeIndexViewModel()
            {
                ZipCode = zipCode, WeatherData = response
            };

            return(View(model));
        }
示例#27
0
        public IActionResult Index()
        {
            var model = new HomeIndexViewModel()
            {
                AvailableProducts = Inventory.AvailableItems.Select(i => new HomeIndexViewModel.ChartItem()
                {
                    Id         = i.Id,
                    Name       = i.Name,
                    PricePerKg = i.PricePerKg
                }).ToList()
            };

            return(View(model));
        }
示例#28
0
        private List <JobPostingDTO> ConfigureSearchAsync(HomeIndexViewModel homeIndexVm)
        {
            List <JobPostingDTO> jobs = new List <JobPostingDTO>();

            for (int i = 0; i < 10; i++)
            {
                jobs.Add(new JobPostingDTO
                {
                    Title = "Car Mart Sales" + i
                });
            }

            return(jobs);
        }
示例#29
0
        public ActionResult UserProfile_Create(DUser_Profile creating, string returnView = "Index")
        {
            string returnUrl = returnView.Equals("Index") ?
                               "http://www.jonathan-burrows.com/profile/home" :
                               "http://www.jonathan-burrows.com/profile/Update";

            HomeIndexViewModel model = new HomeIndexViewModel {
                avatars    = service.Avatar_GetList(),
                profile    = service.Profile_Create(creating, User.Identity.Name),
                navSection = infastructure.PageStructure_GetBySelected(35)
            };

            return(View(returnView, model));
        }
示例#30
0
        public async Task <ActionResult> Index(HomeIndexViewModel model)
        {
            model.Parser = CreateBBCodeParser();

            model.Initialize((await siteService.GetCurrentUser()), CreateHomeNavList(new List <string>()
            {
                indexActionDest
            }));
            model.ActivityFeedList = model.SkipAndTake <ActivityFeedContainer>(siteService.GetSiteActivityFeedItems());

            ModelState.Clear();

            return(View(model));
        }
        public ActionResult Index()
        {
            bool isLoggedIn = (System.Web.HttpContext.Current.User != null) && System.Web.HttpContext.Current.User.Identity.IsAuthenticated;
            HomeIndexViewModel viewModel = new HomeIndexViewModel {
                IsLoggedIn = isLoggedIn
            };

            if (isLoggedIn)
            {
                string userName = User.Identity.GetUserName();
                viewModel.UserName = userName;
            }
            return(View(viewModel));
        }
示例#32
0
        public ActionResult Index()
        {
            var vm = new HomeIndexViewModel();

            vm.AvailableQuizes = db.Quizes.Where(p => p.isPublished).Select(x => new HomeIndexViewModel.QuizInfo
            {
                vId       = x.vId,
                CreatedAt = x.CreatedAt,
                CreatedBy = x.Teacher.Name,
                Name      = x.Name
            }).ToList();

            return(View(vm));
        }
示例#33
0
        public IActionResult Result(string Query, string categoryid, string filter)
        {
            IQueryable <Hamper> hamper = _hamperDataService.Query(h => h.isDiscontinued == false);

            if (Query != null)
            {
                hamper = hamper.Where(h => h.HamperName.ToLower().Contains(Query.ToLower())).Where(hmp => hmp.isDiscontinued == false);
            }
            bool isID = int.TryParse(categoryid, out int id);

            if (isID == false && categoryid != null)
            {
                return(NotFound());
            }
            if (categoryid != null)
            {
                var category = _categoryService.GetSingle(c => c.CategoryId == id);
                if (category == null)
                {
                    return(NotFound());
                }
                hamper = hamper.Where(hmp => hmp.CategoryId == category.CategoryId);
            }

            if (filter == (Array.IndexOf(Enum.GetValues(Filters.Ascending.GetType()), Filters.Ascending).ToString()))
            {
                hamper = hamper.OrderBy(h => h.Cost);
            }
            else if (filter == (Array.IndexOf(Enum.GetValues(Filters.Descending.GetType()), Filters.Descending).ToString()))
            {
                hamper = hamper.OrderByDescending(h => h.Cost);
            }
            else if (filter == null)
            {
                //do nothing
            }
            else
            {
                return(NotFound());
            }

            HomeIndexViewModel vm = new HomeIndexViewModel
            {
                Hampers = hamper.ToList(),
                Total   = hamper.Count()
            };

            return(View(vm));
        }
示例#34
0
        public ActionResult Index()
        {
            IEnumerable<Post> posts;

            using (var context = new ApplicationDbContext())
            {
                posts = context.Posts.Include("Comments").OrderByDescending(p => p.DateCreated).Take(5).ToArray();
            }

            var repository = new PostRepository();
            var recentPostLinks = repository.GetRecentPostLinks();

            var model = new HomeIndexViewModel { Posts = posts, RecentPostLinks = recentPostLinks };

            return View(model);
        }
示例#35
0
        public ActionResult Index()
        {
            var mvcName = typeof(Controller).Assembly.GetName ();
            var isMono = Type.GetType ("Mono.Runtime") != null;

            ViewData ["Version"] = mvcName.Version.Major + "." + mvcName.Version.Minor;
            ViewData ["Runtime"] = isMono ? "Mono" : ".NET";

            var t = _repository.FindAll ();
            var x = t.Result;

            foreach (var item in x)
            {
                Console.WriteLine (item.name);
            }
            var model = new HomeIndexViewModel ();
            model.People = t.Result;
            return View (model);
        }
示例#36
0
        public ActionResult Index(HomeIndexViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string steamWebApiKey = ConfigurationManager.AppSettings["steamWebApiKey"].ToString();
                    SteamId steamId = new SteamId(model.SearchString, steamWebApiKey);

                    ulong steamId64 = steamId.To64Bit();

                    model.AccountId = steamId.AccountId;
                    model.AccountType = steamId.AccountType.ToString();
                    model.Instance = steamId.Instance.ToString();
                    model.CommunityProfileUrl = String.Format("http://steamcommunity.com/profiles/{0}", steamId64);
                    model.LegacySteamId = steamId.ToLegacyFormat();
                    model.ModernSteamId = steamId.ToModernFormat();
                    model.SteamId64 = steamId64;
                    model.Universe = steamId.Universe.ToString();
                    model.IsValidSteamAccount = true;
                    model.ResolvedBy = steamId.ResolvedFrom.ToString();
                }
                catch (VanityUrlNotResolvedException)
                {
                    ModelState.AddModelError("e", "Could not find any Steam Account for your entered value.");
                }
                catch (InvalidSteamCommunityUriException)
                {
                    ModelState.AddModelError("e", "The URL that you provided isn't a valid Steam Community URL.");
                }
                catch (SteamIdNotConstructedException)
                {
                    ModelState.AddModelError("e", "The Steam ID couldn't be constructed based on your input.");
                }

                return View(model);
            }
            else
            {
                return RedirectToRoute("index");
            }
        }
示例#37
0
        public ActionResult Home()
        {
            var projects = this.cache.Get<IEnumerable<Project>>(
               "newestProjects",
               () =>
               {
                   var newestProjectsList = new List<Project>();

                   newestProjectsList.AddRange(this.projects.TopNewestProjects(3).ToList());

                   return newestProjectsList;
               },
                2 * 60 * 60);

            var viewModel = new HomeIndexViewModel
            {
                Projects = projects
            };

            return this.View(viewModel);
        }
示例#38
0
 //
 // GET: /Home/
 public ActionResult Index()
 {
     var vm = new HomeIndexViewModel();
     return View(vm);
 }
 public virtual ActionResult Index()
 {
     var vm = new HomeIndexViewModel();
     return this.View(vm);
 }
 //
 // GET: /Home/
 public ActionResult Index()
 {
     HomeIndexViewModel viewModel = new HomeIndexViewModel();
     viewModel.Title = "Mail Sender";
     return View(viewModel);
 }