initial commit

This commit is contained in:
2026-04-15 15:02:32 +02:00
commit 3bfc79e6d9
1380 changed files with 69684 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.SelfService.Portal.Core.API.Context;
using Microsoft.SelfService.Portal.Core.API.Interfaces;
using Microsoft.SelfService.Portal.Core.API.Models;
namespace Microsoft.SelfService.Portal.Core.API.Repository
{
public class DeploymentGroupRepository : IDeploymentGroupInterface
{
private readonly DataContext _context;
public DeploymentGroupRepository(DataContext context)
{
_context = context;
}
public ICollection<DeploymentGroupModel> GetDeploymentGroups()
{
return _context.DeploymentGroups.ToList();
}
public DeploymentGroupModel GetDeploymentGroupById(Guid Id)
{
return _context.DeploymentGroups
.Include(t => t.Template)
.ThenInclude(tc => tc.TemplateCategory)
.ThenInclude(s => s.Service)
.Include(d => d.Deployments)
.ThenInclude(vm => vm.VirtualMachine)
.Where(dg => dg.Id == Id).FirstOrDefault();
}
public bool AddDeploymentGroupById(DeploymentGroupModel deploymentgroup)
{
_context.Add(deploymentgroup);
return SaveChanges();
}
public bool DeleteDeploymentGroupById(DeploymentGroupModel deploymentgroup)
{
_context.Remove(deploymentgroup);
return SaveChanges();
}
public bool EditDeploymentGroupById(DeploymentGroupModel deploymentgroup)
{
_context.Update(deploymentgroup);
return SaveChanges();
}
public bool CheckDeploymentGroupById(Guid Id)
{
return _context.DeploymentGroups
.Any(d => d.Id == Id);
}
public bool SaveChanges()
{
var saved = _context.SaveChanges();
return saved > 0 ? true : false;
}
}
}