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