Files
parr_api/PARR.DAL/Services/Implementations/ApplicationService.cs

31 lines
1.0 KiB
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.Services.Implementations
{
internal class ApplicationService : BaseService<V1_Application>, IApplicationService
{
private readonly DataContext dataContext;
private readonly ILogger<ApplicationService> logger;
public ApplicationService(DataContext dataContext, ILogger<ApplicationService> logger) : base(logger)
{
this.dataContext = dataContext;
this.logger = logger;
}
protected override DbSet<V1_Application> EntitySet => dataContext.Applications;
protected override DataContext EntitiContext => dataContext;
public async Task<V1_Application?> GetByNameAsync(string appName)
{
return await EntitySet.FirstOrDefaultAsync(t => t.Name.ToLower() == appName.Trim().ToLower());
}
}
}