Exemplo n.º 1
0
        public ViewResult AdsPage(string searchCondition = "&none&", string sortCondition = "created", string sortDirection = "desc", string location = "none")
        {
            AdvertRepository advert = new AdvertRepository();

            if (searchCondition == null)
            {
                searchCondition = "&none&";
            }
            if (sortCondition == null)
            {
                sortCondition = "created";
            }
            if (sortDirection == null)
            {
                sortDirection = "desc";
            }
            if (location == null)
            {
                location = "none";
            }
            if (location.Equals("Anywhere"))
            {
                location = "none";
            }

            List <AdvertisementModel> model = advert.GetAllAdvertisements(searchCondition, sortCondition, sortDirection, location);

            ViewData["Adverts"] = model;

            ViewBag.Name = HttpContext.Session.GetString(SessionName);
            //	ViewBag.Age = HttpContext.Session.GetInt32(SessionAge);

            return(View());
        }
Exemplo n.º 2
0
        public ViewResult AdTest()
        {
            AdvertRepository          advert = new AdvertRepository();
            List <AdvertisementModel> model  = advert.GetAllAdvertisements();

            ViewData["Adverts"] = model;
            return(View());
        }