71 lines
1.9 KiB
C#
71 lines
1.9 KiB
C#
using ManagerService.DTOs;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
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(List<ApplicationInstanceDTO> applicationInstanceDTOs)
|
|
{
|
|
return new InstanceDTO()
|
|
{
|
|
id = Id,
|
|
name = Name,
|
|
dateCreation = DateCreation,
|
|
pinCode = PinCode,
|
|
isPushNotification = IsPushNotification,
|
|
isStatistic = IsStatistic,
|
|
isMobile = IsMobile,
|
|
isTablet = IsTablet,
|
|
isWeb = IsWeb,
|
|
isVR = IsVR,
|
|
applicationInstanceDTOs = applicationInstanceDTOs
|
|
};
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
}
|
|
}
|