public Task<HttpResponseMessage> PesquisarVenda(PesquisaVendaModel model)
        {
            HttpResponseMessage response;
            try
            {
                var usuarioCodigo = ObterCodigoUsuarioLogado();
                var vendas = _vendaService.PesquisarVenda(model.CodigoVenda ?? 0, model.CodigoCliente ?? 0,
                    model.DataCadastro.ToDateTimeWithoutHour(), model.StatusId ?? 0, model.NomeCliente, model.CPFCNPJ,
                    usuarioCodigo);
                response = ReturnSuccess(Mapper.Map<List<VendaModel>>(vendas));
            }
            catch (Exception ex)
            {
                response = ReturnError(ex);
            }

            var tsc = new TaskCompletionSource<HttpResponseMessage>();
            tsc.SetResult(response);
            return tsc.Task;
        }
 public JsonResult PesquisaVenda(PesquisaVendaModel model)
 {
     //var response = ServiceRequest.Post<List<VendaModel>>(model, "api/Venda/PesquisaVenda");
     //return Json(response.Data, JsonRequestBehavior.AllowGet);
     var resultado = new List<VendaModel>
     {
         new VendaModel()
         {
            CodigoVenda = 1,
            ClienteId = 2,
            DataCadastro = DateTime.Now,
            Status = "Aberto",
            NomeCliente = "Vitor",
            CPFCNPJ = "123.456.789-09"
         },
         new VendaModel()
         {
            CodigoVenda = 3,
            ClienteId = 5,
            DataCadastro = DateTime.Now,
            Status = "Aberto",
            NomeCliente = "Felipe",
            CPFCNPJ = "222.333.666-38"
         }
     };
     return Json(new {ObjetoRetorno = resultado}, JsonRequestBehavior.AllowGet);
 }