2025-08-01 16:24:01 +02:00

69 lines
1.8 KiB
C#

using ManagerService.DTOs;
using System;
using System.ComponentModel.DataAnnotations;
namespace ManagerService.Data
{
/// <summary>
/// Instance Information
/// </summary>
public class Instance
{
[Key]
[Required]
public string Id { get; set; }
[Required]
public string Name { get; set; } // UNIQUE !..
public DateTime DateCreation { get; set; }
public string PinCode { get; set; }
public bool IsPushNotification { get; set; }
public bool IsStatistic { get; set; }
public bool IsMobile { get; set; }
public bool IsTablet { get; set; }
public bool IsWeb { get; set; }
public bool IsVR { get; set; }
public InstanceDTO ToDTO()
{
return new InstanceDTO()
{
id = Id,
name = Name,
dateCreation = DateCreation,
pinCode = PinCode,
isPushNotification = IsPushNotification,
isStatistic = IsStatistic,
isMobile = IsMobile,
isTablet = IsTablet,
isWeb = IsWeb,
isVR = IsVR,
};
}
public Instance FromDTO(InstanceDTO instanceDTO)
{
Name = instanceDTO.name;
DateCreation = instanceDTO.dateCreation != null ? instanceDTO.dateCreation.Value : DateTime.Now.ToUniversalTime();
PinCode = instanceDTO.pinCode;
IsPushNotification = instanceDTO.isPushNotification;
IsStatistic = instanceDTO.isStatistic;
IsMobile = instanceDTO.isMobile;
IsTablet = instanceDTO.isTablet;
IsWeb = instanceDTO.isWeb;
IsVR = instanceDTO.isVR;
return this;
}
}
}