StateCommonDs.cs
810 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 StateCommonDs : IStateCommonDs
{
private PostgresDbContext _context;
public StateCommonDs(){
_context = new PostgresDbContext();
}
public Task<IList<StateCommonSelectListDsM>> GetSelectListAsync(){
return Task.Factory.StartNew(GetSelectList);
}
private IList<StateCommonSelectListDsM> GetSelectList()
{
return _context.StateCommon.Select(x => new StateCommonSelectListDsM
{
StateCommonId = x.StateCommonId,
Value = x.Value
}).ToList();
}
}
}