public AlbumForArtistEditContract(AlbumContract albumContract) { AlbumId = albumContract.Id; AlbumName = albumContract.Name; AlbumAdditionalNames = albumContract.AdditionalNames; }
public string ModifyAlbum(AlbumContract modifiedAlbumData) { IMusicProcessor processor = Factory.GetIMusicProcessorInstance(); string message = processor.OverrideAlbum(modifiedAlbumData.ToAlbum()); return(message); }
public string AddAlbum(AlbumContract album) { IMusicProcessor processor = Factory.GetIMusicProcessorInstance(); string message = processor.AddAlbum(album.ArtistName, album.AlbumName); return(message); }
public AlbumContract GetAlbum(int id) { Album album = dataAccess.ReadData_Album(id); AlbumContract output = new AlbumContract(album); return(output); }
public string GenerateDescription(AlbumContract album, Func <DiscType, string> albumTypeNames) { var sb = new StringBuilder(); AddBasicDescription(sb, album, albumTypeNames); sb.Append("."); return(sb.ToString()); }
public AlbumEditViewModel(AlbumContract album, IUserPermissionContext permissionContext, AlbumForEditContract editedAlbum = null) : this() { ParamIs.NotNull(() => album); Album = album; EditedAlbum = editedAlbum; AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(permissionContext); }
public AlbumForUserContract(AlbumForUser albumForUser, ContentLanguagePreference languagePreference) { ParamIs.NotNull(() => albumForUser); Album = new AlbumContract(albumForUser.Album, languagePreference); Id = albumForUser.Id; MediaType = albumForUser.MediaType; PurchaseStatus = albumForUser.PurchaseStatus; Rating = albumForUser.Rating; User = new UserContract(albumForUser.User); }
public AlbumContract[] GetAlbums() { Album[] albums = dataAccess.ReadData_Albums(); AlbumContract[] output = new AlbumContract[albums.Length]; for (int i = 0; i < albums.Length; i++) { output[i] = new AlbumContract(albums[i]); } return(output); }
public List <WebLinkContract> GenerateLinksForAlbum(AlbumContract album) { var links = new List <WebLinkContract>(); links.Add(new WebLinkContract( string.Format("http://ekizo.mandarake.co.jp/shop/en/search.do?searchStrategy=keyword&action=keyword&doujin=all&keyword={0}", album.Name), string.Format(Resources.ExtSites.Search, "Mandarake") + " " + Resources.ExtSites.Autogenerated, WebLinkCategory.Commercial)); return(links); }
//[TestCase(1, "dder", "cfgh", ExpectedResult = "Album added")] public string AddAlbumWrongInputs(int id, string artist, string album) { MusicServiceRest service = new MusicServiceRest(); //Mock mock = new Mock<IDataAccess>().Setup(x => x.SaveData_User(It.IsAny<User>())).Returns(true); var testAlbum = new AlbumContract { IdAlbum = id, ArtistName = artist, AlbumName = album }; string result = service.AddAlbum(testAlbum); return(result); }
public List<WebLinkContract> GenerateLinksForAlbum(AlbumContract album) { var links = new List<WebLinkContract>(); links.Add(new WebLinkContract( string.Format("http://ekizo.mandarake.co.jp/shop/en/search.do?searchStrategy=keyword&action=keyword&doujin=all&keyword={0}", album.Name), string.Format(Resources.ExtSites.Search, "Mandarake") + " " + Resources.ExtSites.Autogenerated, WebLinkCategory.Commercial)); return links; }
private void AddBasicDescription(StringBuilder sb, AlbumContract album, Func <DiscType, string> albumTypeNames) { var typeName = albumTypeNames(album.DiscType); sb.Append(typeName); if (!album.ReleaseDate.IsEmpty) { var date = OptionalDateTime.Create(album.ReleaseDate).ToString(CultureInfo.InvariantCulture); sb.AppendFormat(", released {0}", date); } }
public string Modify() { AccessWcfService service = new AccessWcfService("ModifyAlbum", "PUT"); AlbumContract album = new AlbumContract { IdAlbum = Id, AlbumName = NewAlbumName, ArtistName = NewArtistName }; string inputJson = Newtonsoft.Json.JsonConvert.SerializeObject(album); string returnJson = service.SendJsonToService(inputJson); return(returnJson); }
public FrontPageContract(IEnumerable<ActivityEntry> activityEntries, IEnumerable<NewsEntry> newsEntries, AlbumContract[] newAlbums, IEnumerable<UnifiedCommentContract> recentComments, IEnumerable<Album> topAlbums, Song[] newSongs, SongVoteRating firstSongRating, ContentLanguagePreference languagePreference) { ActivityEntries = activityEntries.Select(e => new ActivityEntryContract(e, languagePreference)).ToArray(); NewAlbums = newAlbums; NewSongs = newSongs.Select(s => new SongWithPVAndVoteContract(s, SongVoteRating.Nothing, languagePreference)).ToArray(); NewsEntries = newsEntries.Select(e => new NewsEntryContract(e)).ToArray(); RecentComments = recentComments.ToArray(); TopAlbums = topAlbums.Select(a => new AlbumWithAdditionalNamesContract(a, languagePreference)).ToArray(); FirstSong = (newSongs.Any() ? new SongWithPVAndVoteContract(newSongs.First(), firstSongRating, languagePreference) : null); }
public ArtistDetailsContract(Artist artist, ContentLanguagePreference languagePreference) : base(artist, languagePreference) { AllNames = string.Join(", ", artist.AllNames.Where(n => n != Name)); BaseVoicebank = artist.BaseVoicebank != null ? new ArtistContract(artist.BaseVoicebank, languagePreference) : null; CreateDate = artist.CreateDate; Description = artist.Description; Draft = artist.Status == EntryStatus.Draft; TranslatedName = new TranslatedStringContract(artist.TranslatedName); LatestAlbums = new AlbumContract[] {}; LatestSongs = new SongForApiContract[] {}; OwnerUsers = artist.OwnerUsers.Select(u => new UserContract(u.User)).ToArray(); Pictures = artist.Pictures.Select(p => new EntryPictureFileContract(p)).ToArray(); TopAlbums = new AlbumContract[] {}; TopSongs = new SongForApiContract[] {}; WebLinks = artist.WebLinks.Select(w => new WebLinkContract(w)).OrderBy(w => w.DescriptionOrUrl).ToArray(); CharacterDesigner = artist.ArtistLinksOfType(ArtistLinkType.CharacterDesigner, LinkDirection.ManyToOne, allowInheritance: true) .Select(g => new ArtistContract(g, languagePreference)).FirstOrDefault(); ChildVoicebanks = artist.CanHaveChildVoicebanks ? artist.ChildVoicebanks.Where(c => !c.Deleted) .Select(c => new ArtistContract(c, languagePreference)).ToArray() : new ArtistContract[0]; Groups = artist.ArtistLinksOfType(ArtistLinkType.Group, LinkDirection.ManyToOne) .Select(g => new ArtistContract(g, languagePreference)).OrderBy(g => g.Name).ToArray(); Illustrators = artist.ArtistLinksOfType(ArtistLinkType.Illustrator, LinkDirection.ManyToOne, allowInheritance: true) .Select(g => new ArtistContract(g, languagePreference)).ToArray(); IllustratorOf = artist.ArtistLinksOfType(ArtistLinkType.Illustrator, LinkDirection.OneToMany) .Select(g => new ArtistContract(g, languagePreference)).OrderBy(a => a.Name).ToArray(); Manager = artist.ArtistLinksOfType(ArtistLinkType.Manager, LinkDirection.ManyToOne, allowInheritance: true) .Select(g => new ArtistContract(g, languagePreference)).FirstOrDefault(); Members = artist.ArtistLinksOfType(ArtistLinkType.Group, LinkDirection.OneToMany) .Select(g => new ArtistContract(g, languagePreference)).OrderBy(g => g.Name).ToArray(); Tags = artist.Tags.ActiveUsages .Select(u => new TagUsageForApiContract(u, languagePreference)) .OrderByDescending(t => t.Count).ToArray(); VoiceProvider = artist.ArtistLinksOfType(ArtistLinkType.VoiceProvider, LinkDirection.ManyToOne, allowInheritance: true) .Select(g => new ArtistContract(g, languagePreference)).FirstOrDefault(); Voicebanks = artist.ArtistLinksOfType(ArtistLinkType.VoiceProvider, LinkDirection.OneToMany) .Select(g => new ArtistContract(g, languagePreference)).OrderBy(a => a.Name).ToArray(); }
public string AddAlbum() { try { AccessWcfService service = new AccessWcfService("AddAlbum", "POST"); var album = new AlbumContract { ArtistName = NewArtistName, AlbumName = NewAlbumName }; string returnMessage = service.SendJsonToService(album); return(returnMessage); } catch (Exception e) { return("Error: No database connection"); } }
public ArchivedAlbumVersionDetailsContract(ArchivedAlbumVersion archived, ArchivedAlbumVersion comparedVersion, ContentLanguagePreference languagePreference) { Album = new AlbumContract(archived.Album, languagePreference); ArchivedVersion = new ArchivedAlbumVersionContract(archived); ComparedVersion = comparedVersion != null ? new ArchivedAlbumVersionContract(comparedVersion) : null; Name = Album.Name; ComparableVersions = archived.Album.ArchivedVersionsManager.Versions .Where(v => v != archived) .Select(a => new ArchivedObjectVersionContract(a)) .ToArray(); Versions = ComparedAlbumsContract.Create(archived, comparedVersion); ComparedVersionId = Versions.SecondId; }
public ArtistDetailsContract(Artist artist, ContentLanguagePreference languagePreference) : base(artist, languagePreference) { AllNames = string.Join(", ", artist.AllNames.Where(n => n != Name)); CreateDate = artist.CreateDate; Description = artist.Description; Draft = artist.Status == EntryStatus.Draft; FollowCount = artist.Users.Count; Groups = artist.Groups.Select(g => new GroupForArtistContract(g, languagePreference)).OrderBy(g => g.Group.Name).ToArray(); TranslatedName = new TranslatedStringContract(artist.TranslatedName); LatestAlbums = new AlbumContract[] {}; LatestSongs = new SongContract[] {}; Members = artist.Members.Select(m => new GroupForArtistContract(m, languagePreference)).OrderBy(a => a.Member.Name).ToArray(); OwnerUsers = artist.OwnerUsers.Select(u => new UserContract(u.User)).ToArray(); Pictures = artist.Pictures.Select(p => new EntryPictureFileContract(p)).ToArray(); Tags = artist.Tags.Usages.Select(u => new TagUsageContract(u)).OrderByDescending(t => t.Count).ToArray(); TopAlbums = new AlbumContract[] {}; TopSongs = new SongContract[] {}; WebLinks = artist.WebLinks.Select(w => new WebLinkContract(w)).OrderBy(w => w.DescriptionOrUrl).ToArray(); }
private AlbumContract[] GetTopAlbums(ISession session, AlbumContract[] recentAlbums) { var cacheKey = "OtherService.PopularAlbums"; var cache = MemoryCache.Default; var item = (TranslatedAlbumContract[])cache.Get(cacheKey); if (item != null) return item.Select(a => new AlbumContract(a, LanguagePreference)).ToArray(); var recentIds = recentAlbums.Select(a => a.Id).ToArray(); var popular = session.Query<Album>() .Where(a => !a.Deleted && a.RatingCount >= 2 && a.RatingAverageInt >= 300 // Filter by number of ratings and average rating && !recentIds.Contains(a.Id)) // Filter out recent albums (that are already shown) .OrderByDescending(a => a.RatingTotal) .Take(100) .ToArray(); var random = CollectionHelper .GetRandomItems(popular, 7) .OrderByDescending(a => a.RatingAverageInt) .ToArray(); var popularAlbumsCached = random .Select(a => new TranslatedAlbumContract(a)) .ToArray(); var popularAlbumContracts = random .Select(a => new AlbumContract(a, LanguagePreference)) .ToArray(); cache.Add(cacheKey, popularAlbumsCached, DateTime.Now + TimeSpan.FromHours(24)); return popularAlbumContracts; }
public ParseAlbumFileResultContract(AlbumContract album) { Album = album; }
public AlbumIconLinkViewModel(AlbumContract album) { Album = album; }