Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -6,5 +6,20 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public string EnvironmentType { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public string? ProviderType { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public string? TenantId { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public string? SubscriptionId { get; set; }
|
||||
|
||||
[Column(Order = 6)]
|
||||
public string? MetadataJson { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,34 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get;
|
||||
using Microsoft.SelfService.Portal.Core.API.Models;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
|
||||
{
|
||||
public class GetEnvironmentDomainDetailsDto : BaseDetailsDto
|
||||
{
|
||||
|
||||
[Column(Order = 1)]
|
||||
public ICollection<GetEnvironmentDetailsDto> Environment { get; set; }
|
||||
public GetDomainDetailsDto Domain { get; set; }
|
||||
|
||||
public static GetEnvironmentDomainDetailsDto FromModel(EnvironmentDomainsModel environmentDomain)
|
||||
{
|
||||
return new GetEnvironmentDomainDetailsDto
|
||||
{
|
||||
Created = environmentDomain.Created,
|
||||
CreatedBy = environmentDomain.CreatedBy,
|
||||
Modified = environmentDomain.Modified,
|
||||
ModifiedBy = environmentDomain.ModifiedBy,
|
||||
Domain = new GetDomainDetailsDto
|
||||
{
|
||||
Id = environmentDomain.Domain.Id,
|
||||
Name = environmentDomain.Domain.Name,
|
||||
FQDN = environmentDomain.Domain.FQDN,
|
||||
NetBIOS = environmentDomain.Domain.NetBIOS,
|
||||
Created = environmentDomain.Domain.Created,
|
||||
CreatedBy = environmentDomain.Domain.CreatedBy,
|
||||
Modified = environmentDomain.Domain.Modified,
|
||||
ModifiedBy = environmentDomain.Domain.ModifiedBy
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.SelfService.Portal.Core.API.Dto.Domain.Get;
|
||||
using Microsoft.SelfService.Portal.Core.API.Models;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
|
||||
@@ -7,8 +7,25 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public ICollection<GetEnvironmentDomainDetailsDto> EnvironmentDomains { get; set; }
|
||||
}
|
||||
|
||||
public static GetEnvironmentDomainDto FromModel(EnvironmentModel environment)
|
||||
{
|
||||
return new GetEnvironmentDomainDto
|
||||
{
|
||||
Id = environment.Id,
|
||||
Name = environment.Name,
|
||||
Created = environment.Created,
|
||||
CreatedBy = environment.CreatedBy,
|
||||
Modified = environment.Modified,
|
||||
ModifiedBy = environment.ModifiedBy,
|
||||
EnvironmentDomains = environment.EnvironmentDomains?
|
||||
.Where(environmentDomain => environmentDomain.Domain != null)
|
||||
.Select(GetEnvironmentDomainDetailsDto.FromModel)
|
||||
.ToList() ?? new List<GetEnvironmentDomainDetailsDto>()
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,5 +6,17 @@ namespace Microsoft.SelfService.Portal.Core.API.Dto.Environment.Get
|
||||
{
|
||||
[Column(Order = 1)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Column(Order = 2)]
|
||||
public string EnvironmentType { get; set; }
|
||||
|
||||
[Column(Order = 3)]
|
||||
public string? ProviderType { get; set; }
|
||||
|
||||
[Column(Order = 4)]
|
||||
public string? TenantId { get; set; }
|
||||
|
||||
[Column(Order = 5)]
|
||||
public string? SubscriptionId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user