private UserSongService CreateUserSongService() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new UserSongService(userId); return(service); }
private bool SetListenState(int userSongId, bool newState) { // Create the service var userId = Guid.Parse(User.Identity.GetUserId()); var service = new UserSongService(userId); // Get the UserAlbum var detail = service.GetUserSongById(userSongId); // Create the UserAlbumEdit model instance with the new Listen state var updatedUserSong = new UserSongEdit { UserID = detail.UserID, UserSongID = detail.UserSongID, UserAlbumID = detail.UserAlbumID, IsFavorited = detail.IsFavorited, HaveListened = newState }; // Return a value indicating whether the update succeeded return(service.UpdateUserSong(updatedUserSong)); }