// GET: Organisations/Details/5 public ActionResult Details(long id, int? page) { Organisation organisation = organisationManager.ReadOrganisation(id); if (organisation != null) { User organiser = userManager.ReadOrganiserFromOrganisation(organisation); IEnumerable<User> coOrganisers = userManager.ReadCoOrganiserFromOrganisation(organisation); OrganisationViewWithPlaylist organisationView = new OrganisationViewWithPlaylist() { Id = id, BannerUrl = organisation.BannerUrl, Name = organisation.Name, Organiser = organiser, CoOrganiser = coOrganisers }; var playlists = organisation.Playlists; int pageSize = 3; if (User != null) user = userManager.ReadUser(User.Identity.Name); UserRole userRole = userManager.ReadUserRoleForUserAndOrganisation(user.Id, id); if (userRole == null) ViewBag.Following = "None"; else if (userRole.Role == Role.Follower) ViewBag.Following = "Following"; else if (userRole.Role == Role.Co_Organiser) ViewBag.Following = "Co-Organiser"; else if (userRole.Role == Role.Organiser) ViewBag.Following = "Organiser"; int pageNumber = (page ?? 1); organisationView.Playlists = playlists.ToPagedList(pageNumber, pageSize); ViewBag.Id = id; ViewBag.TotalMinutesOfPlaytime = organisationManager.ReadTotalTimeOfPlaylistsInMinutes(id); ViewBag.TotalVotesOnPlaylists = organisationManager.ReadTotalVotesForOrganisation(id); return View("Details", organisationView); } else return View("Error"); }