project reorganized
This commit is contained in:
12
WatchIt.Common/WatchIt.Common.Model/Genres/Genre.cs
Normal file
12
WatchIt.Common/WatchIt.Common.Model/Genres/Genre.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace WatchIt.Common.Model.Genres;
|
||||
|
||||
public class Genre
|
||||
{
|
||||
[JsonPropertyName("name")]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[JsonPropertyName("description")]
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace WatchIt.Common.Model.Genres;
|
||||
|
||||
public class GenreQueryParameters : QueryParameters<GenreResponse>
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
[FromQuery(Name = "name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[FromQuery(Name = "description")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
public override bool IsMeetingConditions(GenreResponse item) =>
|
||||
(
|
||||
TestString(item.Name, Name)
|
||||
&&
|
||||
TestString(item.Description, Description)
|
||||
);
|
||||
|
||||
#endregion
|
||||
}
|
||||
20
WatchIt.Common/WatchIt.Common.Model/Genres/GenreRequest.cs
Normal file
20
WatchIt.Common/WatchIt.Common.Model/Genres/GenreRequest.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace WatchIt.Common.Model.Genres;
|
||||
|
||||
public class GenreRequest : Genre
|
||||
{
|
||||
#region PUBLIC METHODS
|
||||
|
||||
public Database.Model.Common.Genre CreateGenre() => new Database.Model.Common.Genre
|
||||
{
|
||||
Name = Name,
|
||||
Description = Description,
|
||||
};
|
||||
|
||||
public void UpdateGenre(Database.Model.Common.Genre genre)
|
||||
{
|
||||
genre.Name = Name;
|
||||
genre.Description = Description;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
28
WatchIt.Common/WatchIt.Common.Model/Genres/GenreResponse.cs
Normal file
28
WatchIt.Common/WatchIt.Common.Model/Genres/GenreResponse.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace WatchIt.Common.Model.Genres;
|
||||
|
||||
public class GenreResponse : Genre
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
[JsonPropertyName("id")]
|
||||
public long Id { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
[SetsRequiredMembers]
|
||||
public GenreResponse(Database.Model.Common.Genre genre)
|
||||
{
|
||||
Id = genre.Id;
|
||||
Name = genre.Name;
|
||||
Description = genre.Description;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user