I want to return a DTO from a query and it does not return anything. I don't know if I have done it right but the where condition exists.
public class ServiciosComandasController : ApiController
{
private TPVRestauranteEntities db = new TPVRestauranteEntities();
// GET: api/ServiciosComandas
public async Task<IQueryable<ServicioComandaDTO>> GetAsync()
{
var ServicioComandaDTO = from s in db.Servicios
where s.Mesas.Ocupada == false
select new ServicioComandaDTO()
{
ID = s.ID,
NumeroMesa = s.Mesas.Numero,
FechaModificacion = s.Pedidos.OrderByDescending(p => p.FechaModificacion).FirstOrDefault<Pedidos>().FechaModificacion,
Pendientes = s.Pedidos.Where(p => p.Comidas.Categorias.Encargado == "Cocina").Count()
};
return ServicioComandaDTO;
}
}