public static Categorias getCategoriaNombreById(int libroId) { Libros libro = libroBRL.getLibroById(libroId); CategoriaDSTableAdapters.CategoriaTableAdapter adapter = new CategoriaDSTableAdapters.CategoriaTableAdapter(); CategoriaDS.CategoriaDataTable table = adapter.GetCategoriaById(libro.CategoriaId); var row = table[0]; Categorias obj = new Categorias(); obj.CategoriaId = row.categoriaID; obj.Nombre = row.nombre; obj.Descripcion = row.descripcion; obj.Estado = row.estado; return(obj); }
public static List <Categorias> getCategoriaById(int libroId) { Libros libro = libroBRL.getLibroById(libroId); CategoriaDSTableAdapters.CategoriaTableAdapter adapter = new CategoriaDSTableAdapters.CategoriaTableAdapter(); CategoriaDS.CategoriaDataTable table = adapter.GetCategoriaById(libro.CategoriaId); List <Categorias> resultado = new List <Categorias>(); foreach (var row in table) { Categorias obj = new Categorias(); obj.CategoriaId = row.categoriaID; obj.Nombre = row.nombre; obj.Descripcion = row.descripcion; obj.Estado = row.estado; resultado.Add(obj); } return(resultado); }