Ejemplo n.º 1
0
        public ViewResult Index(FormCollection form)
        {
            ImagesPage model = new ImagesPage();
            int artistId = form[0] == "" ? 0 : Convert.ToInt32(form[0]);
            if (artistId == 0) { model.Images = db.Images.Include(i => i.Artist).OrderBy(i => i.DisplayOrder); }
            else { model.Images = db.Images.Where(i => i.ArtistId == artistId).OrderBy(i => i.DisplayOrder); }
            model.Artists = new SelectList(db.Artists.ToList(), "ArtistID", "Name", artistId);

            return View(model);
        }
Ejemplo n.º 2
0
        //
        // GET: /Image/
        public ViewResult Index(string id)
        {
            ImagesPage model = new ImagesPage();
            if (String.IsNullOrEmpty(id))
            {
                model.Images = db.Images.Include(i => i.Artist).OrderBy(i => i.DisplayOrder);
                model.Artists = new SelectList(db.Artists.ToList(), "ArtistID", "Name");
            }
            else
            {
                int artistId = Convert.ToInt32(id);
                if (artistId == 0) { model.Images = db.Images.Include(i => i.Artist).OrderBy(i => i.DisplayOrder); }
                else { model.Images = db.Images.Where(i => i.ArtistId == artistId).OrderBy(i => i.DisplayOrder); }
                model.Artists = new SelectList(db.Artists.ToList(), "ArtistID", "Name", artistId);
            }

            return View(model);
        }