本文整理汇总了C#中Entities.List.AsQueryable方法的典型用法代码示例。如果您正苦于以下问题:C# List.AsQueryable方法的具体用法?C# List.AsQueryable怎么用?C# List.AsQueryable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities.List
的用法示例。
在下文中一共展示了List.AsQueryable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllComplejos
public IQueryable<ComplejoModelResponse> GetAllComplejos()
{
try
{
var complejos = from complejo in complejoRepository.All
select complejo;
List<ComplejoModelResponse> list = new List<ComplejoModelResponse>();
list.Add(new ComplejoModelResponse()
{
HttpStatusCode = 200,
HttpStatusDesc = "Ok",
Complejos = complejos
});
return list.AsQueryable();
}
catch (Exception ex)
{
List<ComplejoModelResponse> list = new List<ComplejoModelResponse>();
list.Add(new ComplejoModelResponse()
{
HttpStatusCode = 400,
HttpStatusDesc = "Bad Request",
Complejos = new List<Complejo>().AsQueryable(),
Exception = ex
});
return list.AsQueryable();
}
}
示例2: GetAllReservasByDate
public IQueryable<ReservaModelResponse> GetAllReservasByDate(DateTime fechaHora)
{
try
{
var reservas = from reserva in reservaRepository.All
where reserva.FechaHora == fechaHora
select reserva;
List<ReservaModelResponse> list = new List<ReservaModelResponse>();
list.Add(new ReservaModelResponse()
{
HttpStatusCode = 200,
HttpStatusDesc = "Ok",
Reservas = reservas
});
return list.AsQueryable();
}
catch (Exception ex)
{
List<ReservaModelResponse> list = new List<ReservaModelResponse>();
list.Add(new ReservaModelResponse()
{
HttpStatusCode = 400,
HttpStatusDesc = "Bad Request",
Reservas = new List<Reserva>().AsQueryable(),
Exception = ex
});
return list.AsQueryable();
}
}