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,59 @@
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 RunbookRepository : IRunbookInterface
{
private readonly DataContext _context;
public RunbookRepository(DataContext context)
{
_context = context;
}
public ICollection<RunbookModel> GetRunbooks()
{
return _context.Runbooks
.ToList();
}
public RunbookModel GetRunbookById(Guid Id)
{
return _context.Runbooks
.Where(r => r.Id == Id)
.FirstOrDefault();
}
public bool AddRunbookById(RunbookModel runbook)
{
_context.Add(runbook);
return SaveChanges();
}
public bool EditRunbookById(RunbookModel runbook)
{
_context.Update(runbook);
return SaveChanges();
}
public bool CheckRunbookById(Guid Id)
{
return _context.Runbooks
.Any(r => r.Id == Id);
}
public bool CheckRunbookByName(string Name)
{
return _context.Runbooks
.Any(r => r.Name == Name);
}
public bool SaveChanges()
{
var saved = _context.SaveChanges();
return saved > 0 ? true : false;
}
}
}