示例#1
0
        public async Task <IActionResult> Index(int productPage = 1, string searchByProduct = null, string searchByCategory = null, string searchByShop = null)
        {
            var(products, productsCount) = await _productService.GetFiltered(searchByProduct, searchByCategory, searchByShop, PageSize, productPage);

            var homeVM = new HomeVM()
            {
                Products           = products,
                ProductProposition = new ProductProposition(),
                ShopProposition    = new ShopProposition()
            };

            const string Url = "/User/Home/Index?productPage=:";

            homeVM.PagingInfo = new PagingInfo
            {
                CurrentPage  = productPage,
                ItemsPerPage = PageSize,
                TotalItem    = productsCount,
                UrlParam     = Url
            };

            var shops = await _shopService.GetAllHeaders();

            ViewBag.ShopsSelectList = new SelectList(shops.Select(p => new
            {
                Text = $"Shop: {p.Name}, {p.City} {p.StreetAddress} {p.PostalCode}",
                p.Id
            }), "Id", "Text");

            return(View(homeVM));
        }
示例#2
0
        public IActionResult Booking(HomeVM model)
        {
            //Kullanıcı loginse işlemi yap değilse login sayfasına yönlendir!!

            if (HttpContext.User.Identity.IsAuthenticated)
            {
                Payment payment = new Payment();
                payment.Price = 10;
                _context.Payments.Add(payment);
                _context.SaveChanges();


                int  passengerid = Convert.ToInt32(HttpContext.User.Claims.ToArray()[0].Value);
                Trip trip        = new Trip();
                trip.DriverID       = model.DriverID;
                trip.DeparturePoint = model.Source;
                trip.ArrivalPoint   = model.Destination;
                trip.PassengerID    = passengerid;
                trip.PaymentID      = payment.ID;



                _context.Trips.Add(trip);
                _context.SaveChanges();
                TempData["message"] = "Booking işlemi başarılı!";
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(RedirectToAction("Index", "passengerlogin"));
            }
        }
        public ActionResult Index()
        {
            HomeVM homeVm = new HomeVM();

            List <Recipe> recipes = _recipeService.GetAll().ToList();

            foreach (Recipe item in recipes)
            {
                if (item.IsFavourite == true)
                {
                    homeVm.Recipes.Add(item);
                }
            }

            List <Restaurant> restaurants = _restaurantService.GetAll().ToList();

            foreach (Restaurant item in restaurants)
            {
                if (item.IsFavourite == true)
                {
                    homeVm.Restaurants.Add(item);
                }
            }

            return(View(homeVm));
        }
        public IActionResult Index()
        {
            List <Sliders> slider   = _context.Sliders.Where(s => s.Activeted && !s.IsDeleted).ToList();
            List <Teacher> teachers = _context.Teachers.Where(t => !t.IsDeleted && t.Activeted).Take(4).OrderByDescending(teachers => teachers.Id).ToList();
            List <Course>  courses  = _context.Courses.Where(c => !c.IsDeleted && c.Activeted).Take(3).OrderByDescending(c => c.Created_at).ToList();
            List <Event>   @event   = _context.Events.Where(e => !e.IsDeleted && e.Activeted).Take(4).ToList();
            List <Blog>    blogs    = _context.Blogs.Where(b => !b.IsDeleted && b.Activeted).Take(3).OrderByDescending(b => b.Created_at).ToList();

            _context.IncludeModeratorsBlog(true);
            AboutSection              aboutSection       = _context.AboutSections.FirstOrDefault();
            NoticeSection             noticeSection      = _context.NoticeSections.Include(n => n.Notices).FirstOrDefault();
            List <TestimonialSection> testimonialSection = _context.TestimonialSections.ToList();

            HomeVM homeVM = new HomeVM()
            {
                Sliders             = slider,
                Teachers            = teachers,
                Courses             = courses,
                Events              = @event,
                Blogs               = blogs,
                AboutSections       = aboutSection,
                NoticeSections      = noticeSection,
                TestimonialSections = testimonialSection
            };

            return(View(homeVM));
        }
示例#5
0
        public ActionResult Index(HomeVM model)
        {
            model.CategoryIdSearch = new List <int>();
            foreach (var c in model.CategoryVM)
            {
                if (c.IsSelected)
                {
                    model.CategoryIdSearch.Add(c.Category.CategoryId);
                }
            }

            model.IntimacyIdSearch = new List <int>();
            foreach (var c in model.IntimacyVM)
            {
                if (c.IsSelected)
                {
                    model.IntimacyIdSearch.Add(c.Intimacy.IntimacyId);
                }
            }

            model.CategoryVM = _repo.GetCategoryVMList();
            model.IntimacyVM = _repo.GetIntimacyVMList();
            model.SetCategoryItems(_repo.GetCategoryList());
            model.SetIntimacyItems(_repo.GetIntimacyList());
            model.User    = _repo.GetUserList();
            model.StoryVM = _repo.GetStoryForHome(model.CategoryIdSearch, model.IntimacyIdSearch, model.UserNameSearch + "", model.TitleSearch + "", model.HashtagSearch + "");

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

            if (USER_NUMBER == -1)
            {
                return(RedirectToAction("NewUser"));
            }
            else
            {
                Day  currentDayForUser = DayDAL.GetDayByUserAndDay(USER_NUMBER);
                User user = UserDAL.GetUser(USER_NUMBER);

                USER_NUMBER = user.intUserID;
                DAY_NUMBER  = currentDayForUser.intDayID;

                HomeVM model = new HomeVM
                {
                    user               = user,
                    intCalsLeft        = currentDayForUser.intCalsLeft,
                    intExMinsLeft      = currentDayForUser.intExMinsLeft,
                    mostRecentMeals    = MealDAL.GetMealsByDayAndUser(currentDayForUser.intDayID, user.intUserID).Take(NUM_PREVIEWS).ToList(),
                    mostRecentWorkouts = WorkoutRoutineDAL.GetWorkoutsByDayAndUser(currentDayForUser.intDayID, user.intUserID).Take(NUM_PREVIEWS).ToList()
                };
                return(View(model));
            }
        }
示例#7
0
        public ActionResult Index()
        {
            var vm = new HomeVM();

            vm.SetFeaturedVehicles(ManagerFactory.Create());
            return(View(vm));
        }
        public async Task <IActionResult> Load(int skip)
        {
            User currentUser = await _userManager.GetUserAsync(User);

            List <User> friends = new List <User>();

            foreach (Friend item in _db.Friends.Include(f => f.FriendTo).Include(f => f.FriendFrom).Where(f => f.Accepted && !f.FriendFrom.Deleted && !f.FriendTo.Deleted))
            {
                if (item.FriendFrom == currentUser)
                {
                    friends.Add(item.FriendTo);
                }
                else if (item.FriendTo == currentUser)
                {
                    friends.Add(item.FriendFrom);
                }
            }
            friends.Add(currentUser);
            List <Post> posts = new List <Post>();

            foreach (User friend in friends)
            {
                posts.AddRange(_db.Posts.Include(p => p.User).Include(p => p.PostTaggedUsers).ThenInclude(p => p.User).Include(p => p.PostImages).Include(p => p.PostLikes).Include(p => p.SavedPosts).Include(p => p.Comments).Where(p => p.User == friend));
            }
            HomeVM model = new HomeVM()
            {
                Role  = (await _userManager.GetRolesAsync(currentUser))[0],
                Posts = posts.OrderByDescending(f => f.Date).Skip(skip).Take(10),
                User  = currentUser
            };

            return(PartialView("_FeedPostPartial", model));
        }
示例#9
0
        public IActionResult Index()
        {
            HomeVM model = new HomeVM
            {
                Latest = ctx.Posts
                         .Select(p => new PostsListVM.ItemInfo
                {
                    PostId         = p.PostID,
                    Title          = p.Title,
                    Body           = p.Body,
                    Description    = p.Description,
                    DateCreatedStr = p.DateCreated.ToString("dd.MM.yyyy"),
                    WrittenBy      = p.Moderator.Username,
                    TotalComments  = 0,
                    TotalHits      = p.Hits
                })
                         .ToList(),
                AllCategories = new CategoriesListVM
                {
                    Items = ctx.Categories
                            .Select(c => new CategoriesListVM.CategoryInfo
                    {
                        CatId     = c.CategoryID,
                        Name      = c.Name,
                        PostCount = ctx.Posts.Where(p => p.CategoryId == c.CategoryID).Count()
                    })
                            .ToList()
                }
            };

            return(View(model));
        }
示例#10
0
        public ActionResult Index()
        {
            //get managers
            ListingManager listingManager = ListingManagerFactory.Create();
            SpecialManager specialManager = SpecialManagerFactory.Create();

            //get responses
            ListingFeaturedResponse listingFeaturedResponse = listingManager.GetFeaturedListings();
            SpecialGetAllResponse   specialResponse         = specialManager.GetAllSpecials();

            //validate responses
            if (!listingFeaturedResponse.Success || !specialResponse.Success)
            {
                return(new HttpStatusCodeResult(500, $"Error in cloud. Message:{listingFeaturedResponse.Message} {specialResponse.Message}"));
            }
            else
            {
                //build vm
                HomeVM model = new HomeVM();

                model.SetFeaturedListingItems(listingFeaturedResponse.Listings);
                model.SetSpecialItems(specialResponse.Specials);

                return(View(model));
            }
        }
        HomeVM viewModel;                   // ViewModel ready for use 12-102

        public HomePage()
        {
            InitializeComponent();

            viewModel      = new HomeVM();  // instantiate ViewModel
            BindingContext = viewModel;     // make instantiated ViewModel available to XAML in page (via Command attribute)
        }
示例#12
0
        public async Task <IActionResult> Index()
        {
            ViewBag.City = _db.Cities.ToList();
            HomeVM homeVM = new HomeVM
            {
                Bio            = _db.Bios.FirstOrDefault(),
                PopularJobs    = _db.PopularJobs,
                Statistics     = _db.Statistics,
                Partners       = _db.Partners,
                Blogs          = _db.Blogs,
                PostJobs       = _db.PostJobs.Where(x => x.IsActivated == true).Include(x => x.AppUser).Include(x => x.AppUserPostJobs),
                CompaniesCount = _userManager.Users.Where(x => x.IsCompany == true).Count(),
                PostJobCount   = _db.PostJobs.Count(),
                MembersCount   = _userManager.Users.Where(x => x.IsCompany == false).Count(),
                ApplyCount     = _db.AppUserPostJobs.Count(x => x.IsContacted == true)
            };

            if (User.Identity.IsAuthenticated)
            {
                AppUser user = await _userManager.FindByNameAsync(User.Identity.Name);

                homeVM.AppUser = user;
            }
            return(View(homeVM));
        }
        public async Task <IActionResult> Index()
        {
            HomeVM bnm = new HomeVM();

            bnm.classroms = await _context.Classroomms.Take(4).ToListAsync();

            bnm.TeacherFirst = await _context.Teacherrs.FirstAsync();

            bnm.blogs = await _context.Blogs.OrderByDescending(m => m.Date).Take(3).ToListAsync();

            bnm.comments = await _context.Comments.ToListAsync();

            bnm.users = await _context.Users.ToListAsync();

            bnm.galeryBlogs = await _context.GaleryBlogs.ToListAsync();

            if (_context.Teacherrs.Count() > 4)
            {
                bnm.teacherrs = await _context.Teacherrs.Skip(1).Take(4).ToListAsync();
            }
            else
            {
                bnm.teacherrs = await _context.Teacherrs.ToListAsync();
            }
            bnm.ages = await _context.Ages.ToListAsync();

            return(View(bnm));
        }
示例#14
0
        public async Task <IActionResult> Index()
        {
            //var key = _configuration.GetValue<string>("CryptKey:Key");
            var password = _configuration.GetValue <string>("Admin:Password");
            var username = _configuration.GetValue <string>("Admin:Username");

            if (!await _role.RoleExistsAsync("admin"))
            {
                await _role.CreateAsync(new IdentityRole("admin"));
            }
            var user = await _userManager.FindByNameAsync(username);

            if (user == null)
            {
                IdentityUser newuser = new IdentityUser
                {
                    UserName = username
                };
                var hashed_password = _hash.HashPassword(newuser, password);
                newuser.PasswordHash = hashed_password;
                await _userManager.CreateAsync(newuser);

                await _userManager.AddToRoleAsync(newuser, "admin");
            }
            HomeVM homeVM = new HomeVM
            {
                sliders    = _context.sliders.OrderByDescending(s => s.Date).Take(3),
                projects   = _context.projects.Where(p => p.Status && p.ProjectCategory.Status && p.ShowInHome).OrderByDescending(p => p.Date).Take(6),
                advantages = _context.advantages.Take(4),
                services   = _context.services.Where(s => s.Status)
            };

            return(View(homeVM));
        }
示例#15
0
        public ActionResult QuizInfo(Exam exam)
        {
            int activeQuizId;
            var userId = User.Identity.GetUserId();

            HomeVM vm = new HomeVM();

            if (exam == null)
            {
                return(HttpNotFound());
            }
            Quiz selectedQuiz = db.Quizs.Where(x => x.UserID == userId).FirstOrDefault(x => x.ExamID == exam.ID);

            if (selectedQuiz == null)
            {
                activeQuizId = CreateQuiz(exam.ID);
            }
            else if (selectedQuiz.QuizEnd <= DateTime.Now)
            {
                activeQuizId = CreateQuiz(exam.ID);
            }
            else
            {
                activeQuizId = selectedQuiz.ID;
            }
            return(RedirectToAction("StartExam", new { quizId = activeQuizId, examId = exam.ID }));
        }
示例#16
0
        public Home()
        {
            //MessagingCenter.Send((App)Application.Current, "getCartCountHomeOnly");
            InitializeComponent();
            featuredLabel.IsVisible = false;
            quickLabel.IsVisible    = false;
            offeredLabel.IsVisible  = false;
            categoryLabel.IsVisible = false;
            mainContent.IsVisible   = false;
            IsBusy.IsVisible        = true;

            //((NavigationPage)Application.Current.MainPage).BarBackgroundColor = Color.Black;
            //((NavigationPage)Application.Current.MainPage).BarTextColor = Color.OrangeRed;

            ViewModel      = new HomeVM();
            BindingContext = ViewModel;
            //CustomNavigationBar.getCartCount();
            itemCategoryList.RefreshCommand = new Command(() =>
            {
                getData();
                itemCategoryList.IsRefreshing = false;
            });
            //getData();
            if (!string.IsNullOrEmpty(App.AndroidDeviceToken))
            {
                Application.Current.Properties["device_token"] = App.AndroidDeviceToken;
            }
            //HomeVM.MyCartCounter = "3";
            ViewModel.CartCounter = "0";
            //NavigationBarView.FirstNameLabel.SetBinding(Label.TextProperty, "CartCounter");
        }
示例#17
0
        public IActionResult Index()
        {
            HomeVM homeVM = new HomeVM();

            homeVM.PiesOfTheWeek = _pieRepository.PiesOfTheWeek();
            return(View(homeVM));
        }
示例#18
0
        public async Task <IActionResult> Index()
        {
            var    rqf     = Request.HttpContext.Features.Get <IRequestCultureFeature>();
            var    culture = rqf.RequestCulture.Culture;
            HomeVM model   = new HomeVM {
                Partners            = await _db.Partners.ToListAsync(),
                BestCategory        = await _db.ProductCategories.Include("ProductCategoryTranslate").Include("ProductSubCategories.ProductSubCategoryTranslate").OrderByDescending(a => a.ProductSubCategories.OrderByDescending(a => a.BrandProductCategories.OrderByDescending(a => a.Products.OrderByDescending(a => a.FollowCount).FirstOrDefault().FollowCount).FirstOrDefault().Products.OrderByDescending(a => a.FollowCount).FirstOrDefault().FollowCount).FirstOrDefault().BrandProductCategories.OrderByDescending(a => a.Products.OrderByDescending(a => a.FollowCount).FirstOrDefault().FollowCount).FirstOrDefault().Products.OrderByDescending(a => a.FollowCount).FirstOrDefault().FollowCount).Take(5).ToListAsync(),
                NewProductsCategory = await _db.ProductCategories.Where(x => x.Status).Include("ProductCategoryTranslate").Include("ProductSubCategories.ProductSubCategoryTranslate").
                                      OrderByDescending(a => a.ProductSubCategories.
                                                        OrderByDescending(a => a.BrandProductCategories.
                                                                          OrderByDescending(a => a.Products.
                                                                                            OrderByDescending(a => a.CreatedAt).
                                                                                            FirstOrDefault().CreatedAt).
                                                                          FirstOrDefault().Products.
                                                                          OrderByDescending(a => a.CreatedAt).
                                                                          FirstOrDefault().CreatedAt).
                                                        FirstOrDefault().BrandProductCategories.
                                                        OrderByDescending(a => a.Products.
                                                                          OrderByDescending(a => a.CreatedAt).
                                                                          FirstOrDefault().CreatedAt).
                                                        FirstOrDefault().Products.
                                                        OrderByDescending(a => a.CreatedAt).
                                                        FirstOrDefault().CreatedAt).Take(3).ToListAsync(),
                HomeHeaders        = await _db.HomeHeaders.Include("Product.ProductPhotos").Include("HomeHeaderTranslates").OrderBy(a => a.Order).ToListAsync(),
                NewProducts        = await _db.Products.Include("ProductPhotos").Include("BrandProductCategory.ProductSubCategory").Where(p => p.Status == true).OrderByDescending(a => a.CreatedAt).ToListAsync(),
                MostFollowProducts = await _db.Products.OrderByDescending(a => a.FollowCount).Where(p => p.Status == true).Take(6).ToListAsync(),
                MostSaleds         = await _db.Products.Include("ProductPhotos").Include("BrandProductCategory.ProductSubCategory.ProductSubCategoryTranslate.Language").OrderByDescending(p => p.OrderProducts.Count).Where(p => p.Status == true).Take(9).ToListAsync(),
                LanguageId         = _db.Languages.FirstOrDefault(l => l.LanguageCode == culture.ToString()).Id
            };

            return(View(model));
        }
示例#19
0
        public ActionResult Index()
        {
            HomeVM vm = new HomeVM();

            vm.Subjects = db.Subjects.ToList();
            return(View(vm));
        }
示例#20
0
 public HomePage(UserProfile userProfile)
 {
     InitializeComponent();
     _vm = new HomeVM(userProfile);
     this.BindingContext             = _vm;
     this.artistPicker.SelectedIndex = 0;
 }
示例#21
0
        public ActionResult Index()
        {
            HomeVM hvm          = new HomeVM();
            string CurrentAlias = User.Identity.Name;

            var activities = activityDal.GetAll();

            hvm.IsAdmin       = Configer.Administrators.Contains(CommonUtils.GetShortName(CurrentAlias));
            hvm.CurrentMember = memberDal.GetByCondition(delegate(Member m)
            {
                return(m.Alias.Equals(CurrentAlias));
            }).FirstOrDefault();

            hvm.Activities = new List <ActivityVM>();
            foreach (var item in activities)
            {
                var joinInfosTemp = activityDal.GetAllJoinInfo(item.ID);
                var likeInfosTemp = activityDal.GetAllLikeInfo(item.ID);
                hvm.Activities.Add(new ActivityVM()
                {
                    activity   = item,
                    IsExpeired = DateTime.UtcNow.AddHours(8) > item.StartDateTime,
                    JoinInfos  = joinInfosTemp,
                    LikeInfos  = likeInfosTemp,
                    IsJoin     = joinInfosTemp.Select(r => r.MemberAlias).Contains(CurrentAlias),
                    IsLike     = likeInfosTemp.Select(r => r.MemberAlias).Contains(CurrentAlias),
                    TimeInfo   = CommonUtils.GetTimeInfo(item.StartDateTime, item.EndDateTime)
                });
            }

            return(View(hvm));
        }
示例#22
0
        public HomePage()
        {
            InitializeComponent();

            viewModel      = new HomeVM();
            BindingContext = viewModel;
        }
示例#23
0
        public ActionResult ServiceDetail(int id)
        {
            HomeVM VM = new HomeVM();

            VM.serviceSingle = db.tbl_services.Where(x => x.ServiceId == id).SingleOrDefault();
            return(View(VM));
        }
示例#24
0
        public ActionResult Index()
        {
            //populate list for the viewmodel list property
            var vmList = new List <string>();

            vmList.Add("Item One");
            vmList.Add("Item Two");
            vmList.Add("Item Three");
            vmList.Add("Item Four");
            vmList.Add("Item Five");

            //fill VM with data
            var homeVM = new HomeVM
            {
                Message      = "Hello Vue!",
                MenuItems    = vmList,
                RazorMessage = "Hello Razor!",
            };

            //instance of vue
            var vue = new Vue();

            homeVM.VueData = vue.ParseData(homeVM);
            return(View(homeVM));
        }
示例#25
0
        public ActionResult Index()
        {
            Championship  c   = _champBLL.ChampionshipSelectCurrentByLeague(1);
            Championship  cx1 = _champBLL.ChampionshipSelectCurrentx1();
            List <Team>   tm  = _teamBLL.TeamMatcherList();
            List <Player> pm  = _playerBLL.PlayerMatcherList();

            HomeVM hvm = new HomeVM(c, cx1, tm, pm);

            if (_sessionHelper.CurrentPlayer.Id == 0)
            {
                return(View("index", "_Master", hvm));
            }
            else
            {
                if (_sessionHelper.CurrentPlayer.Admin)
                {
                    return(View("index", "_MasterAdmin", hvm));
                }
                else
                {
                    return(View("index", "_Master2", hvm));
                }
            }
        }
示例#26
0
        public IActionResult Index(int carId = 0)
        {
            if (carId != 0)
            {
                ViewData["carId"] = carId;
            }

            IEnumerable <ProductCategory> categories = _db.ProductCategory
                                                       .Where(c => c.ParentId == null)
                                                       .Include("Children.Products")
                                                       .OrderByDescending(c => c.Products.Count)
                                                       .ToList();
            IEnumerable <string> carMakes = _db.Car.OrderBy(c => c.Make).Select(c => c.Make).Distinct().ToList();
            var vm = new HomeVM()
            {
                Cars = new List <List <CarBrandModel> >()
            };

            vm.Cars.Add(new List <CarBrandModel>());
            foreach (var make in carMakes)
            {
                vm.Cars.Last().Add(new CarBrandModel()
                {
                    Make = make
                });
            }

            vm.Categories = categories;

            return(View(vm));
        }
        public IActionResult Index()
        {
            _logger.LogInformation("home Controller Index option Call");
            HomeVM       homeVM        = new HomeVM();
            MarketResult currentMarket = _marketForecaster.GetMarketPrediction();

            switch (currentMarket.MarketCondition)
            {
            case MarketCondition.StableDown:
                homeVM.MarketForecast = "Market shows signs to go down in a stable state! It is a not a good sign to apply for credit applications! But extra credit is always piece of mind if you have handy when you need it.";
                break;

            case MarketCondition.StableUp:
                homeVM.MarketForecast = "Market shows signs to go up in a stable state! It is a great sign to apply for credit applications!";
                break;

            case MarketCondition.Volatile:
                homeVM.MarketForecast = "Market shows signs of volatility. In uncertain times, it is good to have credit handy if you need extra funds!";
                break;

            default:
                homeVM.MarketForecast = "Apply for a credit card using our application!";
                break;
            }
            _logger.LogInformation("home Controller Index option end");

            return(View(homeVM));
        }
示例#28
0
        public async Task <IActionResult> Index(string search, int page = 1)
        {
            var skip = (page - 1) * 100;
            IQueryable <Image> query;

            if (search == null)
            {
                query = _db.Images.Where(i => 1 == 1);
            }
            else
            {
                var searchParam = $"%{search}%";
                FormattableString searchString = $@"SELECT Images.* FROM Images
                    LEFT JOIN ImageTags ON Images.Id = ImageTags.ImageId
                    LEFT JOIN Tags ON Tags.Id = ImageTags.TagId
                    LEFT JOIN categories ON Images.CategoryId = Categories.Id
                    WHERE path LIKE {searchParam}
                    OR Tags.Name LIKE {searchParam}
                    OR Categories.Name LIKE {searchParam}";
                query = _db.Images.FromSqlInterpolated(searchString);
            }
            var images = await query.Include(i => i.Category).Include(i => i.ImageTags).ThenInclude(it => it.Tag).OrderBy(i => i.Id).Skip(skip).Take(100).ToListAsync();

            var vm = new HomeVM(search: search, page: page, images: images);

            return(View(vm));
        }
 public IActionResult Index()
 {
     homeVM = new HomeVM();
     homeVM.CategoryList = _unitOfWork.Category.GetAll();
     homeVM.SeviceList   = _unitOfWork.Service.GetAll(includeProperties: "Frequency");
     return(View(homeVM));
 }
示例#30
0
        // GET: Home
        public ActionResult Index()
        {
            List <Product> SetPrice = new List <Product>();

            using (var ctx = new AuctionSiteDBEntities())
            {
                var listget = ctx.Auctions.ToList();
                var listmax = ctx.Products.Where(p => p.Bought == false && (DateTime.Now <= EntityFunctions.AddDays(p.TimePost, p.IntervalTime))).OrderByDescending(p => p.PriceDisplay).ToList().Take(5);
                var listend = ctx.Products.Where(p => p.Bought == false && (DateTime.Now <= EntityFunctions.AddDays(p.TimePost, p.IntervalTime)))
                              .OrderBy(p => (EntityFunctions.DiffSeconds(DateTime.Now, EntityFunctions.AddDays(p.TimePost, p.IntervalTime)))).ToList().Take(5);
                var TopSetPriceList = listget.GroupBy(a => a.IDPro).OrderByDescending(a => a.Key).ToList().Take(5);
                foreach (var id in TopSetPriceList)
                {
                    Product pro = ctx.Products.Where(p => p.ID == id.Key && p.Bought == false).FirstOrDefault();
                    if (pro != null)
                    {
                        SetPrice.Add(pro);
                    }
                }

                HomeVM vm = new HomeVM();
                vm.MostSettingPrice = new List <Product>();
                vm.MaxPrice         = new List <Product>();
                vm.EndDate          = new List <Product>();
                vm.EndDate.AddRange(listend);
                vm.MostSettingPrice.AddRange(SetPrice);
                vm.MaxPrice.AddRange(listmax);
                return(View(vm));
            }
        }
示例#31
0
        public ActionResult Index()
        {
            //if (User.Identity.IsAuthenticated)
            //    return RedirectToAction("New", "Project");
            var recentProject = this.serviceProject.GetNew(1, 12, true)
                .ToList();
            var fileIds = recentProject.Select(p => p.PromotedId);
            List<ProjectFile> files = this.serviceFile.GetByIds(fileIds);
            List<UserProfileInfo> recentMembers = this.serviceUser.GetNew(1, 4, true).ToList();
            HomeVM model = new HomeVM();
            model.Projects = recentProject;
            model.Users = recentMembers;
            model.Files = files;

            return View(model);
        }