40 lines
1.0 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|