Added ColorUpdateDTO.cs

This commit is contained in:
quentin 2024-05-20 10:44:49 -05:00
parent 8c58bb2fa3
commit 890c521675
2 changed files with 30 additions and 0 deletions

View 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;
}
}
}

View File

@ -0,0 +1,7 @@
namespace API.DTO
{
public interface IUpdateAdaptable<TModel>
{
void adaptModel(ref TModel model);
}
}