2018-11-14 14:00:08 +00:00
|
|
|
|
using Roadie.Library.Models.Users;
|
|
|
|
|
using System;
|
2018-11-06 03:26:46 +00:00
|
|
|
|
using System.Collections.Generic;
|
2019-02-03 01:01:38 +00:00
|
|
|
|
using System.Diagnostics;
|
2018-11-06 03:26:46 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace Roadie.Library.Models
|
|
|
|
|
{
|
|
|
|
|
[Serializable]
|
2019-02-03 01:01:38 +00:00
|
|
|
|
[DebuggerDisplay("Artist Id {Id}, Name {Artist.Text}")]
|
2018-11-06 03:26:46 +00:00
|
|
|
|
public class ArtistList : EntityInfoModelBase
|
|
|
|
|
{
|
|
|
|
|
public DataToken Artist { get; set; }
|
|
|
|
|
public short? Rating { get; set; }
|
2019-01-23 16:50:36 +00:00
|
|
|
|
public decimal? Rank { get; set; }
|
2018-11-14 14:00:08 +00:00
|
|
|
|
public UserArtist UserRating { get; set; }
|
2018-12-01 18:05:24 +00:00
|
|
|
|
public int? ReleaseCount { get; set; }
|
|
|
|
|
public int? TrackCount { get; set; }
|
|
|
|
|
public int? PlayedCount { get; set; }
|
2018-11-14 14:00:08 +00:00
|
|
|
|
public Image Thumbnail { get; set; }
|
2018-12-01 18:05:24 +00:00
|
|
|
|
public DateTime? LastPlayed { get; set; }
|
2018-12-07 04:45:09 +00:00
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
},
|
2018-12-07 21:02:38 +00:00
|
|
|
|
Thumbnail = thumbnail,
|
2018-12-07 04:45:09 +00:00
|
|
|
|
Rating = artist.Rating,
|
2019-01-23 16:50:36 +00:00
|
|
|
|
Rank = artist.Rank,
|
2018-12-07 04:45:09 +00:00
|
|
|
|
CreatedDate = artist.CreatedDate,
|
|
|
|
|
LastUpdated = artist.LastUpdated,
|
|
|
|
|
LastPlayed = artist.LastPlayed,
|
|
|
|
|
PlayedCount = artist.PlayedCount,
|
|
|
|
|
ReleaseCount = artist.ReleaseCount,
|
|
|
|
|
TrackCount = artist.TrackCount,
|
|
|
|
|
SortName = artist.SortName
|
|
|
|
|
};
|
|
|
|
|
}
|
2018-11-06 03:26:46 +00:00
|
|
|
|
}
|
2019-02-03 01:01:38 +00:00
|
|
|
|
|
|
|
|
|
public class ArtistListComparer : IEqualityComparer<ArtistList>
|
|
|
|
|
{
|
|
|
|
|
public bool Equals(ArtistList x, ArtistList y)
|
|
|
|
|
{
|
|
|
|
|
if (x == null && y == null)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else 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();
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-06 03:26:46 +00:00
|
|
|
|
}
|