initial commit
This commit is contained in:
35
Repository/TemplateRepository.cs
Normal file
35
Repository/TemplateRepository.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
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 TemplateRepository : ITemplateInterface
|
||||
{
|
||||
private readonly DataContext _context;
|
||||
|
||||
public TemplateRepository(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public ICollection<TemplateModel> GetTemplates()
|
||||
{
|
||||
return _context.Templates
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public TemplateModel GetTemplateById(Guid Id)
|
||||
{
|
||||
return _context.Templates
|
||||
.Where(t => t.Id == Id)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
public bool CheckTemplateById(Guid Id)
|
||||
{
|
||||
return _context.Templates
|
||||
.Any(t => t.Id == Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user