//Channel main page public IActionResult Main(string id) { if (id == null) { return(NotFound()); } var channel = _service.GetChannel(id).Result; if (channel == null) { return(NotFound()); } ViewData["public"] = _service.CheckIfPublic(channel); ViewData["owner"] = false; var user = _userManager.GetUserAsync(User).Result; if (user != null) { var channelMember = _service.GetChannelMember(user, channel).Result; //Check if the user is a channel member if (channelMember == null) { ViewData["member"] = false; } else { ViewData["member"] = true; } if (channel.CreatorId == user.Id) { ViewData["owner"] = true; } } var albums = _albumService.GetAlbumModels(channel); //List of all channel albums var members = _service.GetChannelMembers(channel); //List of all channel members var creator = _userManager.FindByIdAsync(channel.CreatorId).Result; //Channel creator var tags = _service.GetChannelTags(channel); //List of all channel tags var channelModel = new ChannelModel { Id = channel.Id, Title = channel.Title, Description = channel.Description, Creator = creator, CreationDate = channel.CreationDate, Albums = albums, ChannelMembers = members, Tags = tags }; return(View(channelModel)); }