mirror of
https://github.com/sphildreth/roadie
synced 2024-11-23 04:33:16 +00:00
64 lines
No EOL
2.1 KiB
C#
64 lines
No EOL
2.1 KiB
C#
using Roadie.Library.Models.Users;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
|
|
namespace Roadie.Library.Models
|
|
{
|
|
[Serializable]
|
|
[DebuggerDisplay("Artist Id {Id}, Name {Artist.Text}")]
|
|
public class ArtistList : EntityInfoModelBase
|
|
{
|
|
public DataToken Artist { get; set; }
|
|
public bool IsValid => Id != Guid.Empty;
|
|
public DateTime? LastPlayed { get; set; }
|
|
public IEnumerable<string> MissingReleasesForCollection { get; set; }
|
|
public int? PlayedCount { get; set; }
|
|
public decimal? Rank { get; set; }
|
|
public short? Rating { get; set; }
|
|
public int? ReleaseCount { get; set; }
|
|
public Image Thumbnail { get; set; }
|
|
public int? TrackCount { get; set; }
|
|
public UserArtist UserRating { get; set; }
|
|
|
|
public static ArtistList FromDataArtist(Data.Artist artist, Image thumbnail)
|
|
{
|
|
return new ArtistList
|
|
{
|
|
DatabaseId = artist.Id,
|
|
Id = artist.RoadieId,
|
|
Artist = new DataToken
|
|
{
|
|
Text = artist.Name,
|
|
Value = artist.RoadieId.ToString()
|
|
},
|
|
Thumbnail = thumbnail,
|
|
Rating = artist.Rating,
|
|
Rank = artist.Rank,
|
|
CreatedDate = artist.CreatedDate,
|
|
LastUpdated = artist.LastUpdated,
|
|
LastPlayed = artist.LastPlayed,
|
|
PlayedCount = artist.PlayedCount,
|
|
ReleaseCount = artist.ReleaseCount,
|
|
TrackCount = artist.TrackCount,
|
|
SortName = artist.SortName
|
|
};
|
|
}
|
|
}
|
|
|
|
public class ArtistListComparer : IEqualityComparer<ArtistList>
|
|
{
|
|
public bool Equals(ArtistList x, ArtistList y)
|
|
{
|
|
if (x == null && y == null)
|
|
return true;
|
|
if (x != null && y == null || x == null && y != null) return false;
|
|
return x.DatabaseId.Equals(y.DatabaseId) && x.Id.Equals(y.Id);
|
|
}
|
|
|
|
public int GetHashCode(ArtistList item)
|
|
{
|
|
return item.Id.GetHashCode();
|
|
}
|
|
}
|
|
} |