public async Task <IImdbItem> MoveToAnotherCollectionAsync(VideoRoleViewModel role) { Debug.Assert(this.VideoRoleCollectionSources.Count == 2); var series = this.VideoRoleCollectionSources[0]; var video = this.VideoRoleCollectionSources[1]; var manager = this.GetManagers().VideoRoleManager; if (role.IsSeriesRole ? Exchange(series, video, role.Source) : Exchange(video, series, role.Source)) { await manager.UpdateAsync(series); await manager.UpdateAsync(video); return(role.IsSeriesRole ? this.video : this.series as IImdbItem); } return(null); }
public async Task DeleteAsync(VideoRoleViewModel role) { Debug.Assert(this.VideoRoleCollectionSources.Count == 2); var series = this.VideoRoleCollectionSources[0]; var video = this.VideoRoleCollectionSources[1]; var collection = role.IsSeriesRole ? series : video; if (collection.MajorRoles?.Remove(role.Source) == true || collection.MinorRoles?.Remove(role.Source) == true) { this.Roles.Collection.Remove(role); await this.GetManagers().VideoRoleManager.UpdateAsync(collection); var id = (role.Source as ICoverParent).CoverId; if (!string.IsNullOrWhiteSpace(id)) { await this.GetManagers().CoverManager.RemoveAsync(id); } } }
public int Compare(VideoRoleViewModel x, VideoRoleViewModel y) => x.OrderIndex.CompareTo(y.OrderIndex);
public async Task<IImdbItem> MoveToAnotherCollectionAsync(VideoRoleViewModel role) { Debug.Assert(this.VideoRoleCollectionSources.Count == 2); var series = this.VideoRoleCollectionSources[0]; var video = this.VideoRoleCollectionSources[1]; var manager = this.GetManagers().VideoRoleManager; if (role.IsSeriesRole ? Exchange(series, video, role.Source) : Exchange(video, series, role.Source)) { await manager.UpdateAsync(series); await manager.UpdateAsync(video); return role.IsSeriesRole ? this.video : this.series as IImdbItem; } return null; }