ASP.NET / ASP.NET Helpdesk System Using jQuery and Bootstrap / HelpdeskDAL / DepartmentDAO.cs
DepartmentDAO.cs
Raw
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace HelpdeskDAL
{
    public class DepartmentDAO
    {
        // Using Repository

        readonly IRepository<Department> _repo;
        public DepartmentDAO()
        {
            _repo = new HelpdeskRepository<Department>();
        }

        //
        // Retrieve all Departments
        //
        public async Task<List<Department>> GetAll()
        {
            List<Department> allDepartments;
            try
            {
                allDepartments = await _repo.GetAll();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Problem in " + GetType().Name + " " +
                MethodBase.GetCurrentMethod()!.Name + " " + ex.Message);
                throw;
            }
            return allDepartments;
        }
    }
}