NonInventPurchasingSystem/CPRNIMS.Domain/Services/Account/Department.cs
2026-01-20 07:44:30 +08:00

40 lines
1.0 KiB
C#

using CPRNIMS.Domain.Contracts.Account;
using CPRNIMS.Infrastructure.Database;
using CPRNIMS.Infrastructure.Entities.Account;
using Microsoft.Data.SqlClient;
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 Department : IDepartment
{
private readonly NonInventoryDbContext _dbContext;
public Department(NonInventoryDbContext applicationDbContext)
{
_dbContext = applicationDbContext;
}
public async Task<List<Departments>> GetDepartment()
{
try
{
var departments = await _dbContext.Departments
.Where(d => d.IsActive == true)
.ToListAsync();
return departments;
}
catch (SqlException ex)
{
ex.ToString();
throw;
}
}
}
}