sanAntonioSeniorGolf/API/DTO/Base/Update/EventUpdateDTO.cs

29 lines
902 B
C#

using DAL.Models;
using System.ComponentModel.DataAnnotations;
namespace API.DTO.Base.Update
{
public class EventUpdateDTO : IUpdateAdaptable<Event>
{
public ulong? savedEventId { get; set; }
[MaxLength(64)]
public UnSettable<string?>? name { get; set; }
public UnSettable<ulong?>? bgColorId { get; set; }
public UnSettable<ulong?>? fgColorId { get; set; }
public UnSettable<ulong?>? imageId { get; set; }
public bool? hidden { get; set; }
public void adaptModel(ref Event model)
{
if (savedEventId != null) model.savedEventId = (ulong)savedEventId;
if (name != null) model.name = ((UnSettable<string?>)name).value;
if (bgColorId != null) model.bgColorId = bgColorId.Value.value;
if (fgColorId != null) model.bgColorId = fgColorId.Value.value;
if (imageId != null) model.imageId = imageId.Value.value;
if (hidden != null) model.hidden = (bool)hidden;
}
}
}