public EstadoPrestamoDTO BuscarPorId(int id) { try { Conexion.Abrir(); string sql = "SELECT TOP(1) * " + "FROM EstadoPrestamo " + "WHERE EstadoPrestamoId = " + id; SqlCommand cmd = new SqlCommand(sql, Conexion.Conn); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { EstadoPrestamoDTO ep = new EstadoPrestamoDTO( Convert.ToInt32(reader["EstadoPrestamoId"].ToString()), reader["EstadoPrestamo"].ToString() ); return(ep); } else { return(null); } } catch (SqlException e) { Console.WriteLine(e.StackTrace); return(null); } finally { if (Conexion.Conn != null) { Conexion.Cerrar(); } } }
public void Ingresar(EstadoPrestamoDTO obj) { throw new NotImplementedException(); }