diff --git a/API/DTO/Base/Update/ColorUpdateDTO.cs b/API/DTO/Base/Update/ColorUpdateDTO.cs new file mode 100644 index 0000000..3b68996 --- /dev/null +++ b/API/DTO/Base/Update/ColorUpdateDTO.cs @@ -0,0 +1,23 @@ +using DAL.Models; +using System.ComponentModel.DataAnnotations; + +namespace API.DTO.Base.Update +{ + public class ColorUpdateDTO : IUpdateAdaptable + { + 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; + } + } +} diff --git a/API/DTO/IUpdateAdaptable.cs b/API/DTO/IUpdateAdaptable.cs new file mode 100644 index 0000000..354eb26 --- /dev/null +++ b/API/DTO/IUpdateAdaptable.cs @@ -0,0 +1,7 @@ +namespace API.DTO +{ + public interface IUpdateAdaptable + { + void adaptModel(ref TModel model); + } +}