Esempio n. 1
0
        public bool Select(int Id, Models.User user)
        {
            bool ok = false;

            //string select = "select * from user where IdUser = "******"select * from user where IdUser = {Id}";

            DbDataReader dr = _db.ExecuteSelect(select);

            if (dr.HasRows)
            {
                ok = true;

                user = Map(dr).First();
            }

            _db.Close();

            return(ok);
        }
Esempio n. 2
0
        public List <Models.Product> Search(string name)
        {
            List <Models.Product> products = new List <Models.Product>();

            string select = $"select * from product where Name like @name";

            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("@name", "%" + name + "%");

            DbDataReader dr = _db.ExecuteSelect(select, param);

            products = Map(dr);

            _db.Close();

            return(products);
        }