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 ServiceRepository : IServiceInterface { private readonly DataContext _context; public ServiceRepository(DataContext context) { _context = context; } public ICollection GetServices() { return _context.Services .ToList(); } public ServiceModel GetServiceById(Guid Id) { return _context.Services .Where(s=>s.Id == Id) .FirstOrDefault(); } public bool CheckServiceById(Guid Id) { return _context.Services .Any(s =>s.Id == Id); } public ServiceModel GetServiceByName(string Name) { return _context.Services .Where(s => s.Name == Name) .FirstOrDefault(); } public bool CheckServiceByName(string Name) { return _context.Services .Any(s => s.Name == Name); } } }