Files
WatchIt/WatchIt.Common/WatchIt.Common.Model/Persons/PersonRequest.cs

63 lines
1.3 KiB
C#
Raw Normal View History

2024-10-04 19:32:25 +02:00
using System.Diagnostics.CodeAnalysis;
2024-10-02 16:09:11 +02:00
using System.Text.Json.Serialization;
namespace WatchIt.Common.Model.Persons;
public class PersonRequest : Person
{
#region PROPERTIES
[JsonPropertyName("gender_id")]
public short? GenderId { get; set; }
#endregion
2024-10-04 19:32:25 +02:00
#region CONSTRUCTORS
[SetsRequiredMembers]
public PersonRequest()
{
Name = string.Empty;
}
[SetsRequiredMembers]
public PersonRequest(PersonResponse person)
{
Name = person.Name;
FullName = person.FullName;
Description = person.Description;
BirthDate = person.BirthDate;
DeathDate = person.DeathDate;
GenderId = person.Gender?.Id;
}
#endregion
2024-10-02 16:09:11 +02:00
#region PUBLIC METHODS
public Database.Model.Person.Person CreatePerson() => new Database.Model.Person.Person
{
Name = Name,
FullName = FullName,
Description = Description,
BirthDate = BirthDate,
DeathDate = DeathDate,
GenderId = GenderId,
};
2024-10-03 16:18:17 +02:00
public void UpdatePerson(Database.Model.Person.Person person)
{
person.Name = Name;
person.FullName = FullName;
person.Description = Description;
person.BirthDate = BirthDate;
person.DeathDate = DeathDate;
person.GenderId = GenderId;
}
2024-10-02 16:09:11 +02:00
#endregion
}