Added ColorUpdateDTO.cs
This commit is contained in:
parent
8c58bb2fa3
commit
890c521675
23
API/DTO/Base/Update/ColorUpdateDTO.cs
Normal file
23
API/DTO/Base/Update/ColorUpdateDTO.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using DAL.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.DTO.Base.Update
|
||||
{
|
||||
public class ColorUpdateDTO : IUpdateAdaptable<Color>
|
||||
{
|
||||
public byte? red { get; set; }
|
||||
public byte? blue { get; set; }
|
||||
public byte? green { get; set; }
|
||||
|
||||
[MaxLength(64)]
|
||||
public string? name { get; set; }
|
||||
|
||||
public void adaptModel(ref Color model)
|
||||
{
|
||||
if (red != null) model.red = (byte)red;
|
||||
if (blue != null) model.blue = (byte)blue;
|
||||
if (green != null) model.green = (byte)green;
|
||||
if (name != null) model.name = name;
|
||||
}
|
||||
}
|
||||
}
|
7
API/DTO/IUpdateAdaptable.cs
Normal file
7
API/DTO/IUpdateAdaptable.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace API.DTO
|
||||
{
|
||||
public interface IUpdateAdaptable<TModel>
|
||||
{
|
||||
void adaptModel(ref TModel model);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user