RoadDirectionDs.cs
826 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 RoadDirectionDs : IRoadDirectionDs
{
private PostgresDbContext _context;
public RoadDirectionDs(){
_context = new PostgresDbContext();
}
public Task<IList<RoadDirectionSelectListDsM>> GetSelectListAsync(){
return Task.Factory.StartNew(GetSelectList);
}
private IList<RoadDirectionSelectListDsM> GetSelectList()
{
return _context.RoadDirection.Select(x => new RoadDirectionSelectListDsM
{
RoadDirectionId = x.RoadDirectionId,
Name = x.Name
}).ToList();
}
}
}