public IActionResult BuscarPorIdCliente([FromRoute] int id) { List <Pet> pets = _petDAO.ListarPetPorCliente(id); if (pets.Count > 0) { return(Ok(pets)); } return(NotFound(new { msg = "Nenhum pet encontrado!" })); }
public IActionResult BuscarClientePorPet(Reserva r) { //Cliente c = new Cliente(); var c = _clienteDAO.BuscarClientePorCPF(r.Pet.cliente); if (c != null) { ViewBag.Pets = new SelectList(_petDAO.ListarPetPorCliente(c.IdCliente), "IdPet", "Nome"); return(RedirectToAction(nameof(Cadastrar))); } return(RedirectToAction("Index")); }