public ActionResult Index() { ArtistDashboardModel model = new ArtistDashboardModel(); try { int artistId = WebSecurity.CurrentUserId; var userDataCollection = from d in m_context.Artists where d.ArtistId == artistId select new { d.CreateDate, d.LastActivityDate, d.Messages.Count , d.ProfileViews, d.Tasks , d.UserName, d.ProfileLastViewDate, d.AvatarURL , defualtPlaylist = d.PlayLists.Where(p => p.IsDefaultPlaylist == true) }; var userData = userDataCollection.FirstOrDefault(); var workspaces = from w in m_context.ArtistCollaborationSpaces.Where(e => e.ArtistId == artistId) select w.CollaborationSpace; model.AccountCreatedDate = userData.CreateDate; model.ArtistName = userData.UserName; model.PasswordLastChangedDate = WebSecurity.GetPasswordChangedDate(WebSecurity.CurrentUserName); model.ProfileLastViewedDate = userData.ProfileLastViewDate.Value; model.ProfileBookmark = string.Concat(SharedConfig.ApplicationURL, "/", userData.UserName); model.ProfileViews = userData.ProfileViews; model.AvatarURL = userData.AvatarURL; model.NewsFeed = m_context.GetUserAlerts(artistId).ToList(); model.Tasks = userData.Tasks.ToList(); model.CollaborationSpaces = workspaces.ToList(); model.ArtistSongs = userData.defualtPlaylist.FirstOrDefault().PlaylistItems.ToList(); } catch (Exception e) { model.ErrorMessage = "Sorry. Something dreadful has occured. Please accept our sincerest apology."; } return(View(model)); }
public ActionResult NewsFeed() { NewsFeedModel model = new NewsFeedModel(); int artistId = WebSecurity.CurrentUserId; try { var obj = m_context.GetUserAlerts(artistId); if (obj != null) { model.NewsFeed = obj.ToList(); } if (model.NewsFeed.Count() == 0) { return(PartialView("_NoDataPartial", "Sorry, we could not find any stories that match your interests.")); } } catch { //TODO: Log exception return(PartialView("_NoDataPartial", "Sorry could not access the data.")); } return(PartialView("_NewsFeedPartial", model)); }