コード例 #1
0
        public ActionResult Search(string query, long? category, int page = 0, int size = 5)
        {
            Category selectedCategory;

            var auctions =
                _repository
                    .Search(query, category, out selectedCategory)
                    .OrderBy(x => x.EndTime)
                    .Skip(page * size)
                    .Take(size);

            var viewModel = new AuctionsViewModel
            {
                Auctions = auctions.Select(Mapper.DynamicMap<AuctionViewModel>).ToArray(),
                Page = page,
                PageSize = size,
                SearchQuery = query,
            };

            ViewBag.Title = string.Format("Search results for '{0}'", query);
            ViewBag.Query = query ?? string.Empty;

            if (selectedCategory != null)
            {
                ViewBag.SelectedCategory = selectedCategory;
                viewModel.CategoryName = selectedCategory.Name;
            }

            if (Request.IsAjaxRequest())
                return Json(viewModel, JsonRequestBehavior.AllowGet);

            return View("Search", viewModel);
        }
コード例 #2
0
        public ActionResult Index(int?categoryID, string searchTearm, int?pageNo, int?pageSize)
        {
            var model = new AuctionsViewModel();

            pageNo            = pageNo.HasValue ? pageNo.Value > 0 ? pageNo.Value : 1 : 1;
            pageSize          = pageSize.HasValue ? pageSize.Value > 10 ? pageSize.Value : 10 : 10;
            model.AllAuction  = AuctionService.Instance.GetAllAuction(categoryID, searchTearm, pageNo.Value, pageSize.Value);
            model.Categories  = CategoriesService.Instance.GetAllCategories();
            model.PageSize    = pageSize.Value;
            model.SearchTearm = searchTearm;
            if (string.IsNullOrEmpty(categoryID.ToString()) == false)
            {
                model.CategoryID = categoryID.Value;
            }
            var totalItem = AuctionService.Instance.TotalItemsCount(categoryID, searchTearm);

            if (model.AllAuction != null && model.AllAuction.Count > 0)
            {
                model.Pager = new Pager(totalItem, pageNo.Value, pageSize.Value);
            }
            model.PageTitle       = "Auctions";
            model.PageDescription = "This auctions list";

            if (Request.IsAjaxRequest())
            {
                return(PartialView(model));
            }
            else
            {
                return(View(model));
            }
        }
コード例 #3
0
        public ActionResult Index(int?categoryID, string searchTearm, int?pageNo, int?pageSize)
        {
            AuctionsViewModel model = new AuctionsViewModel();

            model.PageTitle       = "Home Page";
            model.PageDescription = "This is home page";
            pageNo                = pageNo.HasValue ? pageNo.Value > 0 ? pageNo.Value : 1 : 1;
            pageSize              = pageSize.HasValue ? pageSize.Value > 9 ? pageSize.Value : 9 : 9;
            model.AllAuction      = AuctionService.Instance.GetAllAuction(categoryID, searchTearm, pageNo.Value, pageSize.Value);
            model.Categories      = CategoriesService.Instance.GetAllCategories();
            model.PromotedAuction = AuctionService.Instance.GetPromoAuction();
            model.SliderImages    = SliderImageServices.Instance.GetAllSliderImage();
            var totalpage = AuctionService.Instance.TotalItemsCount(categoryID, searchTearm);

            model.Pager       = new Pager(totalpage, pageNo, pageSize.Value);
            model.SearchTearm = searchTearm;
            model.PageSize    = pageSize.Value;
            model.PageNo      = pageNo.Value;
            if (Request.IsAjaxRequest())
            {
                return(PartialView(model));
            }
            else
            {
                return(View(model));
            }
        }
コード例 #4
0
        public ActionResult Index()
        {
            var viewModel = new AuctionsViewModel();

            viewModel.Auctions = AuctionServices.Instance.GetAllAuctions();

            return(View(viewModel));
        }
コード例 #5
0
        public ActionResult Details(string id)
        {
            AuctionsViewModel actionsViewModel = new AuctionsViewModel();

            ViewBag.PageTitle       = " Auction Details Page";
            ViewBag.PageDescription = "This is Auction Details Page";
            var auction = service.GetById(id);

            return(View(auction));
        }
コード例 #6
0
        public ActionResult Index()
        {
            AuctionsViewModel model = new AuctionsViewModel();

            //var allAuctions = service.GetAuctions();
            model.AllAuctions      = service.GetAuctions();
            model.FeaturedAuctions = service.GetFeaturedAuctions();
            model.Categories       = categoriesService.GetCategories();
            model.Title            = "Home";
            return(View(model));
        }
コード例 #7
0
        public ActionResult Details(int Id)
        {
            AuctionsViewModel model = new AuctionsViewModel();

            model.PageTitle       = "Details";
            model.PageDescription = "Auction details";

            model.Auction = AuctionsService.Instance.GetAuctionById(Id);

            return(View(model));
        }
コード例 #8
0
        public ActionResult Index()
        {
            AuctionsViewModel vModel = new AuctionsViewModel();

            vModel.PageTitel       = "Home Page";
            vModel.PageDescription = "This is Home Page";
            vModel.AllAuction      = service.GetAllAuction();
            vModel.PromotedAuction = service.GetPromotedAuction();

            return(View(vModel));
        }
コード例 #9
0
        public ActionResult Index()
        {
            AuctionsViewModel model = new AuctionsViewModel();

            model.PageTitle       = "HomePage";
            model.PageDescription = "This is HomePage";

            model.AllAuctions      = AuctionsService.Instance.GetAllAuction();
            model.PromotedAuctions = AuctionsService.Instance.GetPromotedAuctions();

            return(View(model));
        }
コード例 #10
0
        public ActionResult Index()
        {
            AuctionsViewModel actionsViewModel = new AuctionsViewModel();

            ViewBag.PageTitle                 = "Home Page";
            ViewBag.PageDescription           = "This is Home Page";
            actionsViewModel.AllAuctions      = service.GetAll();
            actionsViewModel.PromotedAuctions = service.GetPromotedAuctions();

            //  ViewBag.AllAuctions = service.GetAll();

            return(View(actionsViewModel));
        }
コード例 #11
0
        //public ActionResult Listing()
        //{

        //	List<Auction> model = new List<Auction>();
        //	model = AuctionsService.Instance.GetAuctions();
        //	return PartialView(model);
        //}

        // GET: Auctions
        public ActionResult Index()
        {
            AuctionsViewModel model = new AuctionsViewModel();

            model.Auctions = AuctionsService.Instance.GetAuctions();
            if (Request.IsAjaxRequest())
            {
                return(PartialView(model));
            }
            else
            {
                return(View(model));
            }
        }
コード例 #12
0
        public ActionResult Index()
        {
            AuctionsViewModel auctionModel = new AuctionsViewModel();

            auctionModel.PageTitle       = "Home Page";
            auctionModel.PageDescription = "This is home page.";

            auctionModel.EntityId = (int)EntitiesEnum.Auction;

            auctionModel.PromotedAuctions = AuctionsService.Instance.GetPromotedAuctions();
            auctionModel.AllAuctions      = AuctionsService.Instance.GetAuctions();

            return(View(auctionModel));
        }
コード例 #13
0
        public ActionResult Index(int?categoryId, string search, int?pageNo)
        {
            AuctionsViewModel model = new AuctionsViewModel();

            model.CategoryId       = categoryId;
            model.SearchTerm       = search;
            model.PageNo           = pageNo;
            model.PageTitle        = "HomePage";
            model.PageDescription  = "This is HomePage";
            model.EntityId         = (int)EntitiesEnum.Auction;
            model.PromotedAuctions = AuctionsService.Instance.GetPromotedAuctions();

            return(View(model));
        }
コード例 #14
0
        public ActionResult Index()
        {
            AuctionsViewModel vModel = new AuctionsViewModel();

            vModel.AllAuctions = service.GetAllAuctions();

            vModel.PromotedAuctions = service.GetPromotedAuctions();

            ViewBag.Title = " Home Page";

            ViewBag.MyPageTitle = "Marketplace";



            return(View(vModel));
        }
コード例 #15
0
        public ActionResult SortedAuctions(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Category          cat   = categoriesService.GetCategoryByID(id);
            AuctionsViewModel model = new AuctionsViewModel();

            if (cat == null)
            {
                return(RedirectToAction("Error"));
            }
            model.AllAuctions = cat.Auctions;
            model.Title       = cat.Name;
            return(View(model));
        }
コード例 #16
0
        public PartialViewResult Listing(int?categoryId, string search, int?pageNo)
        {
            var pageSize = 5;

            pageNo = pageNo ?? 1;

            var auctionsModel = new AuctionsViewModel();

            auctionsModel.AllAuction = AuctionService.Instance.GetAllAuction(categoryId, search, pageNo.Value, pageSize);

            var totalAuctions = AuctionService.Instance.TotalItemsCount(categoryId, search);

            auctionsModel.Pager = new Pager(totalAuctions, pageNo, pageSize);

            auctionsModel.CategoryID  = categoryId.Value;
            auctionsModel.SearchTearm = search;

            return(PartialView(auctionsModel));
        }
コード例 #17
0
        public ActionResult Index()
        {
            AuctionsViewModel vModel = new AuctionsViewModel();

            vModel.PageTitle       = "Marketplace";
            vModel.PageDescription = "Auctions Page";

            var auctions = service.GetAllAuctions();

            vModel.AllAuctions = new List <Entities.Auction>();
            vModel.AllAuctions.AddRange(auctions);

            //vModel.AllAuctions.RemoveAt(0);

            vModel.PromotedAuctions = service.GetPromotedAuctions();


            return(View(vModel));
        }
コード例 #18
0
        public ActionResult ByCategory(string categoryKey)
        {
            Category category;

            var auctions = _repository.FindByCategoryKey(categoryKey, out category);

            if (category == null)
                return HttpNotFound();

            ViewBag.Title = category.Name;
            ViewBag.SelectedCategory = category.Id;

            var viewModel = new AuctionsViewModel
            {
                Auctions = auctions.Select(Mapper.DynamicMap<AuctionViewModel>).ToArray(),
                CategoryName = category.Name,
            };

            return View("Search", viewModel);
        }
コード例 #19
0
        public ActionResult Search(string query, long?category, int page = 0, int size = 5)
        {
            Category selectedCategory;


            var auctions =
                _repository
                .Search(query, category, out selectedCategory)
                .OrderBy(x => x.EndTime)
                .Skip(page * size)
                .Take(size);



            var viewModel = new AuctionsViewModel
            {
                Auctions    = auctions.Select(Mapper.DynamicMap <AuctionViewModel>).ToArray(),
                Page        = page,
                PageSize    = size,
                SearchQuery = query,
            };


            ViewBag.Title = string.Format("Search results for '{0}'", query);
            ViewBag.Query = query ?? string.Empty;


            if (selectedCategory != null)
            {
                ViewBag.SelectedCategory = selectedCategory;
                viewModel.CategoryName   = selectedCategory.Name;
            }


            if (Request.IsAjaxRequest())
            {
                return(Json(viewModel, JsonRequestBehavior.AllowGet));
            }

            return(View("Search", viewModel));
        }
コード例 #20
0
        public PartialViewResult HomeAuctionList(int?categoryId, string search, int?pageNo)
        {
            var pageSize = 6;

            pageNo = pageNo ?? 1;

            AuctionsViewModel model = new AuctionsViewModel();

            model.PageTitle       = "HomePage";
            model.PageDescription = "This is HomePage";
            model.CategoryId      = categoryId;
            model.SearchTerm      = search;
            model.AllAuctions     = AuctionsService.Instance.FilterAuctions(categoryId, search, pageNo.Value, pageSize);
            model.Categories      = CategoryService.Instance.AllCategories();
            model.EntityId        = (int)EntitiesEnum.Auction;

            var totalAuctions = AuctionsService.Instance.GetAuctionCount(categoryId, search);

            model.pager = new Pager(totalAuctions, pageNo, pageSize);

            return(PartialView(model));
        }
コード例 #21
0
        public ActionResult ByCategory(string categoryKey)
        {
            Category category;

            var auctions = _repository.FindByCategoryKey(categoryKey, out category);

            if (category == null)
            {
                return(HttpNotFound());
            }

            ViewBag.Title            = category.Name;
            ViewBag.SelectedCategory = category.Id;

            var viewModel = new AuctionsViewModel
            {
                Auctions     = auctions.Select(Mapper.DynamicMap <AuctionViewModel>).ToArray(),
                CategoryName = category.Name,
            };

            return(View("Search", viewModel));
        }
コード例 #22
0
        public void LoadView(ViewType typeView)
        {
            switch (typeView)
            {
            case ViewType.Login:
            {
                LoginUC        view = new LoginUC();
                LoginViewModel vm   = new LoginViewModel(this);
                view.DataContext        = vm;
                this.OutputView.Content = view;
                break;
            }

            case ViewType.Registration:
            {
                Registration    viewF = new Registration();
                RegistViewModel vmF   = new RegistViewModel(this);
                viewF.DataContext       = vmF;
                this.OutputView.Content = viewF;
                break;
            }

            case ViewType.Forum:
            {
                Forum_main          viewF = new Forum_main();
                Forum_mainViewModel vmF   = new Forum_mainViewModel(this);
                viewF.DataContext       = vmF;
                this.OutputView.Content = viewF;
                break;
            }

            case ViewType.Forum_topic:
            {
                Forum_topic          viewF = new Forum_topic();
                Forum_topicViewModel vmF   = new Forum_topicViewModel(this);
                viewF.DataContext       = vmF;
                this.OutputView.Content = viewF;
                break;
            }

            case ViewType.User_room:
            {
                User_Room          viewF = new User_Room();
                User_RoomViewModel vmF   = new User_RoomViewModel(this);
                viewF.DataContext       = vmF;
                this.OutputView.Content = viewF;
                break;
            }

            case ViewType.AutoPark:
            {
                AutoPark          viewF = new AutoPark();
                AutoParkViewModel vmF   = new AutoParkViewModel(this);
                viewF.DataContext       = vmF;
                this.OutputView.Content = viewF;
                break;
            }

            case ViewType.AddCar:
            {
                AddCar          viewF = new AddCar();
                AddCarViewModel vmF   = new AddCarViewModel(this);
                viewF.DataContext       = vmF;
                this.OutputView.Content = viewF;
                break;
            }

            case ViewType.Auctions:
            {
                Auctions          viewF = new Auctions();
                AuctionsViewModel vmF   = new AuctionsViewModel(this);
                viewF.DataContext       = vmF;
                this.OutputView.Content = viewF;
                break;
            }

            case ViewType.Auction:
            {
                ver03.Views.Auction viewF = new ver03.Views.Auction();
                AuctionViewModel    vmF   = new AuctionViewModel(this);
                viewF.DataContext       = vmF;
                this.OutputView.Content = viewF;
                break;
            }

            case ViewType.AddAuction:
            {
                AddAuction          viewF = new ver03.Views.AddAuction();
                AddAuctionViewModel vmF   = new AddAuctionViewModel(this);
                viewF.DataContext       = vmF;
                this.OutputView.Content = viewF;
                break;
            }

            case ViewType.MainPage:
            {
                MainPage          viewF = new ver03.Views.MainPage();
                MainPageViewModel vmF   = new MainPageViewModel(this);
                viewF.DataContext       = vmF;
                this.OutputView.Content = viewF;
                break;
            }

            case ViewType.Info:
            {
                Info          viewF = new ver03.Views.Info();
                InfoViewModel vmF   = new InfoViewModel(this);
                viewF.DataContext       = vmF;
                this.OutputView.Content = viewF;
                break;
            }
            }

            //void LoadPageAndViewModel<T,V>(T page, V viewModel)
            //    where T: new()
            //    where V: class, new()
            //{
            //    T viewF = new T();
            //    V vmF = new V(this);
            //    viewF.DataContext = vmF;
            //    this.OutputView.Content = viewF;
            //}
        }