【问题标题】:Ado.Net Api Query DTOAdo.Net Api 查询 DTO
【发布时间】:2021-05-03 15:45:04
【问题描述】:

我想从查询中返回 DTO,但它不返回任何内容。 我不知道我是否做得对,但 where 条件存在。

    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;
        }
     }

【问题讨论】:

    标签: asp.net api ado.net dto


    【解决方案1】:

    已解决,我没有创建“Servicio”

    【讨论】:

      猜你喜欢
      • 2012-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-10
      • 2014-05-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多