Files
WatchIt/WatchIt.Common/WatchIt.Common.Model/Genres/GenreResponse.cs

41 lines
932 B
C#
Raw Normal View History

2024-04-27 22:36:16 +02:00
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
2024-09-29 23:00:32 +02:00
using WatchIt.Common.Query;
2024-04-27 22:36:16 +02:00
namespace WatchIt.Common.Model.Genres;
2024-09-29 23:00:32 +02:00
public class GenreResponse : Genre, IQueryOrderable<GenreResponse>
2024-04-27 22:36:16 +02:00
{
#region PROPERTIES
2024-09-29 23:00:32 +02:00
[JsonIgnore]
public static IDictionary<string, Func<GenreResponse, IComparable>> OrderableProperties { get; } = new Dictionary<string, Func<GenreResponse, IComparable>>
{
{ "id", x => x.Id },
{ "name", x => x.Name },
{ "description", x => x.Description }
};
2024-04-27 22:36:16 +02:00
[JsonPropertyName("id")]
public long Id { get; set; }
#endregion
#region CONSTRUCTORS
2024-09-19 22:58:39 +02:00
[JsonConstructor]
public GenreResponse() {}
2024-04-27 22:36:16 +02:00
[SetsRequiredMembers]
public GenreResponse(Database.Model.Common.Genre genre)
{
Id = genre.Id;
Name = genre.Name;
Description = genre.Description;
}
#endregion
}