public ActionResult ViewUser(string username) { PandaRepo db = new PandaRepo(); Account user = db.GetUserByName(username); return(View(user)); }
public ActionResult Index(int?page) { // Gets username of logged in user. string username = User.Identity.Name; IEnumerable <Request> requests = (from item in db.GetAllRequests() orderby item.DateCreated descending select item); // By default we start at page one if (!page.HasValue) { page = 1; } int pageSize = 15; int pageNumber = (page ?? 1); if (username.Length != 0) { foreach (Request req in requests) { // If you have upvoted this request it will return true, false otherwise. req.UpvotedByUser = db.GetReqUpBool(req.ID, db.GetUserByName(username).ID); } } // Gets language dropdown ViewBag.Languages = db.GetLanguageListItems(); return(View(requests.ToPagedList(pageNumber, pageSize))); }