SettlementLocationDs.cs 836 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 SettlementLocationDs : ISettlementLocationDs
    {
        private PostgresDbContext _context;
        public SettlementLocationDs(){
            _context = new PostgresDbContext();
        }
        public Task<IList<SettlementLocationSelectListDsM>> GetSelectListAsync(){
            return Task.Factory.StartNew(GetSelectList);
        }
        private IList<SettlementLocationSelectListDsM> GetSelectList()
        {
           return _context.SettlementLocation.Select(x => new SettlementLocationSelectListDsM
            {
                Id = x.Id, 
                Name = x.Value
            }).ToList();
        }

    }
}