예제 #1
0
        public ActionResult Index()
        {
            #region Card
            HttpCookie cookie = Request.Cookies["Card"];
            if (cookie != null)
            {
                List <string> Card = cookie.Value.Split(',').ToList();
                Card.RemoveAt(Card.Count - 1);

                ViewBag.Card      = Card;
                ViewBag.CardCount = Card.Count;
            }
            else
            {
                ViewBag.CardCount = 0;
            }
            #endregion

            ViewBag.setting = context.Settings.FirstOrDefault();

            vmHome home = new vmHome();
            home.Reviews        = context.Reviews.ToList();
            home.Blogs          = context.Blogs.ToList();
            home.Menus          = context.Menus.ToList();
            home.WeAreVincents  = context.WeAreVincents.FirstOrDefault();
            home.Setting        = context.Settings.FirstOrDefault();
            home.Sliders        = context.Sliders.ToList();
            home.MenuCategories = context.MenuCategories.ToList();
            return(View(home));
        }
예제 #2
0
        public vmHome FindTrack(spSelectAllTitles_Result item, string userName, int listYear)
        {
            Tracks track = db.Tracks.Find(item.Tracks_TrackId);
            var    model = new vmHome()
            {
                ID          = track.trackId,
                Name        = track.trackName,
                TrackArtist = track.trackArtist,
                TrackYear   = track.trackYear,
                ListYear    = listYear,
                VoteCount   = db.spSelectAllVotes(listYear, item.Tracks_TrackId).Count(),
                Voted       = db.spCheckUserVote(listYear, item.Tracks_TrackId, userName).Count() != 0 ? true : false,
            };

            return(model);
        }
예제 #3
0
        public ActionResult Index()
        {
            vmHome home = new vmHome();

            home.About        = context.Abouts.FirstOrDefault();
            home.Blogs        = context.Blogs.ToList();
            home.Boards       = context.Boards.ToList();
            home.Courses      = context.Courses.ToList();
            home.Events       = context.Events.ToList();
            home.Testimonials = context.Testimonials.ToList();
            home.MainSliders  = context.MainSliders.ToList();

            ViewBag.Page = "Home";

            return(View(home));
        }
예제 #4
0
        //POST: Home
        public ActionResult Index(vmHome Home)
        {
            Home          home   = new Home();
            List <vmHome> tracks = null;

            if (Home.PostForm == "1")
            {
                if (db.spCheckUserVote(Home.ListYear, Home.ID, User.Identity.Name).Count() == 0)
                {
                    Track_YearList_User TrackYearListUser = new Track_YearList_User()
                    {
                        Track_TrackId       = Home.ID,
                        Users_UserName      = User.Identity.Name,
                        YearList_YearListId = Home.ListYear
                    };
                    db.Track_YearList_User.Add(TrackYearListUser);
                    db.SaveChanges();
                }
                tracks = home.GetList(User.Identity.Name, Home.ListYear);
            }
            else if (Home.PostForm == "2")
            {
                if (Home.TrackYear != DateTime.MinValue)
                {
                    tracks = home.GetList(User.Identity.Name, Home.DropdownYear, Home.TrackArtist, Home.TrackYear.Year);
                }
                else
                {
                    tracks = home.GetList(User.Identity.Name, Home.DropdownYear, Home.TrackArtist, 0);
                }
            }



            ViewBag.DropdownYear = home.CreateAndOrderDropdown();
            List <vmHome> Tracks = tracks.OrderByDescending(t => t.VoteCount).ToList();

            return(View(Tracks));
        }