public async Task <IActionResult> BuscarClientes(string name, string firstApe, string secondApe,
                                                         int?tlf, string email)
        {
            String          token           = HttpContext.Session.GetString("TOKEN");
            Cliente         cliente         = new Cliente();
            DetallesCliente detallesCliente = new DetallesCliente();

            if (tlf != null || email != null)
            {
                cliente = await this.ServiceApi.GetClienteByTlfEmailAsync(token, tlf.GetValueOrDefault(), email);

                detallesCliente = await this.ServiceApi.GetDetailsClienteByTlfEmailAsync(token, tlf.GetValueOrDefault(), email);

                ViewData["Detalles"] = detallesCliente;
            }
            else if (name != null && firstApe != null && secondApe != null)
            {
                cliente = await this.ServiceApi.GetClienteByNameAsync(token, name, firstApe, secondApe);

                detallesCliente = await this.ServiceApi.GetDetailsClienteByNameAsync(token, name);

                ViewData["Detalles"] = detallesCliente;
            }
            else if (name == null || firstApe == null || secondApe == null)
            {
                return(RedirectToAction("BuscarClientes", "Clientes"));
            }

            return(View(cliente));
        }
        public async Task <IActionResult> DetallesCliente(int id)
        {
            String          token = HttpContext.Session.GetString("TOKEN");
            DetallesCliente dtcli = await this.ServiceApi.GetDetailsClienteByIdAsync(token, id);

            if (dtcli == null)
            {
                return(RedirectToAction("DTClient", "Clientes", new { id = id }));
            }
            else
            {
                List <FacturaDetalle> factList = await this.ServiceApi.GetFacturaDetailsByFechaAsync(token, dtcli.cliente, dtcli.lastService);

                ViewData["lista"] = factList;
            }
            return(View(dtcli));
        }