using CPRNIMS.Domain.Contracts.Account; using CPRNIMS.Infrastructure.Database; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CPRNIMS.Domain.Services.Account { public class ControllerAccess : IControllerAccess { private readonly NonInventoryDbContext _dbContext; public ControllerAccess(NonInventoryDbContext dbContext) { _dbContext = dbContext; } public async Task> GetControllerAccessByUserId(string userId) { try { var getMyControllerAccess = await _dbContext.ControllerAccess .FromSqlRaw($"EXEC GetElementAccessByUserId @UserId = '{userId}'") .ToListAsync(); return getMyControllerAccess ?? new List(); } catch (Exception ex) { ex.ToString(); throw; } } } }