SurfaceTypeDs.cs
808 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 SurfaceTypeDs : ISurfaceTypeDs
{
private PostgresDbContext _context;
public SurfaceTypeDs(){
_context = new PostgresDbContext();
}
public Task<IList<SurfaceTypeSelectListDsM>> GetSelectListAsync(){
return Task.Factory.StartNew(GetSelectList);
}
private IList<SurfaceTypeSelectListDsM> GetSelectList()
{
return _context.SurfaceType.Select(x => new SurfaceTypeSelectListDsM
{
SurfaceTypeId = x.SurfaceTypeId,
Name = x.Name
}).ToList();
}
}
}