예제 #1
0
        public List <CatalogoViewModel> GetCatalogo()
        {
            string    query     = $"SELECT Id, Title, ImagePath, Author, Rating, FullPrice_Amount, FullPrice_Currency, CurrentPrice_Currency, CurrentPrice_Amount FROM Courses";
            DataSet   dataSet   = db.Query(query);
            DataTable dataTable = dataSet.Tables[0];
            List <CatalogoViewModel> catalogoList = new List <CatalogoViewModel>();

            foreach (DataRow catalogoRow in dataTable.Rows)
            {
                CatalogoViewModel CatalogoViewModel = CatalogoViewModel.FromDbToView(catalogoRow);
                catalogoList.Add(CatalogoViewModel);
            }
            return(catalogoList);
        }