Refactor code structure for improved readability and maintainability

This commit is contained in:
Torsten Brendgen
2026-05-16 16:45:28 +02:00
parent 14f856fdb3
commit 96a3e98109
426 changed files with 29236 additions and 114 deletions

View File

@@ -51,8 +51,14 @@ namespace Microsoft.SelfService.Portal.Core.API.Repository
public ICollection<TemplateModel> GetAvailableTemplatesByEnvironmentId(Guid Id)
{
var environment = _context.Environments.Where(e => e.Id == Id).FirstOrDefault();
var isCloudEnvironment = environment != null
&& environment.EnvironmentType != EnvironmentTypes.OnPrem;
return _context.Templates.Where(t => t.CloudTemplate == environment.CloudEnabled).ToList();
return _context.Templates
.Include(t => t.TemplateCategory)
.ThenInclude(tc => tc.Service)
.Where(t => t.TemplateCategory.Service.IsCloudService == isCloudEnvironment)
.ToList();
}
public bool CheckEnvironmentById(Guid Id)