public ActionResult DoListByTag(ListByTagView tagView) { CheckAda(); String Username = GetLoggedInUser(); if (Username == null) { return(ForceLogin()); } Tag tag = db.Tags.Find(tagView.Id); if (tag == null) { return(RedirectToAction("Error", "Home", new { ErrId = "ListByTag" })); } ViewBag.Username = Username; /* * Eager loading of related entities */ var images = db.Entry(tag).Collection(t => t.Images).Query().Include(im => im.User).ToList(); return(View("ListAll", tag.Images)); }
public ActionResult ListByTag() { CheckAda(); if (GetLoggedInUser() == null) { return(ForceLogin()); } ListByTagView tagView = new ListByTagView(); tagView.Tags = new SelectList(db.Tags, "Id", "Name", 1); return(View(tagView)); }