DepartmentAffiliationDs.cs 898 Bytes
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MapsDb.Interfaces;
using MapsDb.Models;
using MapsModels.DsModels;
namespace MapsDb.DataService
{
    public class DepartmentAffiliationDs : IDepartmentAffiliationDs
    {
        private PostgresDbContext _context;
        public DepartmentAffiliationDs(){
            _context = new PostgresDbContext();
        }
        public Task<IList<DepartmentAffiliationSelectListDsM>> GetSelectListAsync(){
            return Task.Factory.StartNew(GetSelectList);
        }
        private IList<DepartmentAffiliationSelectListDsM> GetSelectList()
        {
           return _context.DepartmentAffiliation.Select(x => new DepartmentAffiliationSelectListDsM
            {
                DepartmentAffiliationId = x.DepartmentAffiliationId, 
                Name = x.Name
            }).ToList();
        }

    }
}