Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -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>()
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user