// //no additional methods here since it will be traslated into song url /song/GUID // //---------------------------------------------------------------------------------------------------------- // for song landing page //[OutputCache(Duration = 1200, VaryByParam = "none")] public ActionResult getSongByID(string song_guid) { // 1.general declarations //----------------------------------------------------------------------------------------------------- hypster_tv_DAL.songsManagement song_manager = new hypster_tv_DAL.songsManagement(); hypster_tv_DAL.memberManagement memberManager = new hypster_tv_DAL.memberManagement(); //----------------------------------------------------------------------------------------------------- int song_int_id = 0; if (Int32.TryParse(song_guid, out song_int_id) == false) { return(RedirectPermanent("/")); } // 2.get model //----------------------------------------------------------------------------------------------------- hypster.ViewModels.SongLandingPageViewModel songModel = new ViewModels.SongLandingPageViewModel(); songModel.song = song_manager.GetSongByID(song_guid); songModel.songComments_list = song_manager.Get_SongComments(songModel.song.id); //----------------------------------------------------------------------------------------------------- return(View(songModel)); }
public ActionResult PostSongComment(string songComment, string songGuid) { if (User.Identity.IsAuthenticated == false) { return(RedirectPermanent("/account/SignIn?ReturnUrl=/song/" + songGuid)); } hypster_tv_DAL.Hypster_Entities hyDB = new hypster_tv_DAL.Hypster_Entities(); hypster_tv_DAL.songsManagement songManager = new hypster_tv_DAL.songsManagement(); hypster_tv_DAL.memberManagement memberManager = new hypster_tv_DAL.memberManagement(); hypster_tv_DAL.Song curr_song = new hypster_tv_DAL.Song(); curr_song = songManager.GetSongByID(songGuid); hypster_tv_DAL.songComment p_comment = new hypster_tv_DAL.songComment(); p_comment.song_ID = curr_song.id; p_comment.ipAddress = IpAddress(); p_comment.status = (int)hypster_tv_DAL.newsCommentStatus.NoActive; p_comment.user_ID = memberManager.getMemberByUserName(User.Identity.Name).id; p_comment.userName = User.Identity.Name; p_comment.postDate = DateTime.Now; p_comment.comment = songComment; if (p_comment.comment.Length > 1990) { p_comment.comment = p_comment.comment.Substring(0, 1990); } hyDB.songComments.AddObject(p_comment); hyDB.SaveChanges(); return(RedirectPermanent("/song/" + songGuid)); }