public IActionResult Get(int id) { ClienteIndOutput data = new ClienteIndOutput(); data = productRepository.GetByID(id); if (data.status.Equals(Status.Error)) { return(NotFound(data)); } return(Ok(data)); }
public ClienteIndOutput GetByID(int id) { ClienteIndOutput clienteId = new ClienteIndOutput(); clienteId = productRepository.GetByID(id); if (clienteId != null) { clienteId.message = ""; clienteId.status = Status.Ok; } else { clienteId = new ClienteIndOutput(); clienteId.message = "No existe cliente"; clienteId.status = Status.Error; } return(clienteId); }
public ClienteIndOutput GetByID(int id) { ClienteIndOutput entidad = new ClienteIndOutput(); using (IDatabase db = Connection) { try { entidad = db.SingleOrDefault <ClienteIndOutput>("SELECT IdCliente as id, Nombre as nombre, Apellido as apellido FROM Cliente where eliminado =0 and IdCliente=@0", id); } catch { } finally { db.CloseSharedConnection(); } } return(entidad); }