예제 #1
0
        // GET: Images
        public ActionResult Index(int?page, int?album, string search)
        {
            var images = imageHandler.All();

            // Filter:
            if (album != null && album != 0)
            {
                images = images.Where(im => im.Albums.id == album);
            }

            // Search:
            images = imageHandler.Search(images, search);

            List <Albums> albumList = albumHandler.All().ToList();

            albumList.Insert(0, new Albums {
                id = 0, title = "All"
            });
            ViewBag.Albums = new SelectList(albumList, "id", "title");

            int pageSize   = PagingSettings.PageSizeInAlbum;
            int pageNumber = (page ?? 1);

            return(View(images.ToPagedList(pageNumber, pageSize)));
        }
예제 #2
0
 /// <summary>
 /// Is the image Empty
 /// </summary>
 /// <typeparam name="T">Image Pixel Type</typeparam>
 /// <param name="img">Image</param>
 /// <returns>Whether or not image is "blank"</returns>
 protected static bool ImageEmpty <T>(IImage <T> img)
     where T : struct, IEquatable <T>
 {
     return(img.All(x => x.Equals(default(T))));
 }