Beispiel #1
0
        // GET: Admin/JSONGallery
        public string GetJsonGallery(int?PageNumber, int?NumberOfItems)
        {
            //Set the page number and number of items from the request
            var _pageNumber    = PageNumber;
            var _numberOfItems = NumberOfItems;
            var _numberOfPages = 0;

            //Retrieve gallery images and populate the gallery model
            var model      = GalleryBLL.GetImageGallery((int)_pageNumber, (int)_numberOfItems, out _numberOfPages);
            var JsonString = new JSONModel();

            JsonString.NumberOfPages = _numberOfPages;
            JsonString.Gallery       = model;

            //Send JSON response to calling object
            return(JsonConvert.SerializeObject(JsonString));
        }
Beispiel #2
0
        // GET: Admin/Gallery
        public ActionResult Index(int?PageNumber, int?NumberOfItems)
        {
            var _pageNumber    = 0;
            var _numberOfItems = 0;
            var result         = 0;
            var _numberOfPages = 0;

            if (int.TryParse(Convert.ToString(PageNumber), out result))
            {
                //Pagenumber was present so set it
                _pageNumber = (int)PageNumber;
            }
            else
            {
                //No page number was set so default to page 1
                _pageNumber = 1;
            }
            if (int.TryParse(Convert.ToString(NumberOfItems), out result))
            {
                //Number of items was present so set it
                _numberOfItems = (int)NumberOfItems;
            }
            else
            {
                //Number of items was not set, so default to page 1 with 8 items
                _numberOfItems = 8;
                _pageNumber    = 1;
            }

            //Retrieve gallery images
            var model = GalleryBLL.GetImageGallery(_pageNumber, _numberOfItems, out _numberOfPages);

            //Set these items to manage the pagers in the view
            ViewBag.NumberOfPages = _numberOfPages;
            ViewBag.NumberOfItems = _numberOfItems;
            ViewBag.CurrentPage   = _pageNumber;
            var ManufacturerList = ManufacturerBLL.GetManufacturerList();
            var DropDownList     = new SelectList(ManufacturerList, "Id", "Display");

            ViewBag.ManufacturerList = DropDownList;
            return(View(model));
        }