Beispiel #1
0
        public CatalogoViewModel GetDettagli(string id)
        {
            string            query     = $"SELECT Id, Title, ImagePath, Author, Rating, FullPrice_Amount, FullPrice_Currency, CurrentPrice_Currency, CurrentPrice_Amount FROM Courses WHERE Id={id}";
            DataSet           dataSet   = db.Query(query);
            DataTable         dataTable = dataSet.Tables[0];
            CatalogoViewModel dettaglio = new CatalogoViewModel();

            foreach (DataRow riga in dataTable.Rows)
            {
                dettaglio = CatalogoViewModel.FromDbToView(riga);
            }

            return(dettaglio);
        }
Beispiel #2
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);
        }