Beispiel #1
0
        private static EAD_Project.Models.product_details FillDTO(SqlDataReader reader)
        {
            var dto = new EAD_Project.Models.product_details();

            dto.name          = reader.GetString(0);
            dto.email         = reader.GetString(1);
            dto.textarea_text = reader.GetString(2);
            return(dto);
        }
Beispiel #2
0
        public static int Update(EAD_Project.Models.product_details dto)
        {
            String sqlQuery = "";

            sqlQuery = String.Format("Update dbo.product_details Set email='{0}',textarea_text='{1}' WHERE name='{2}')",
                                     dto.email, dto.textarea_text, dto.name);
            using (DBHelper helper = new DBHelper())
            {
                return(helper.ExecuteQuery(sqlQuery));
            }
        }
Beispiel #3
0
        public static int Save(EAD_Project.Models.product_details dto)
        {
            String sqlQuery = "";

            sqlQuery = String.Format("INSERT INTO dbo.product_details(name,email,textarea_text) VALUES('{0}','{1}','{2}')",
                                     dto.name, dto.email, dto.textarea_text);

            using (DBHelper helper = new DBHelper())
            {
                return(helper.ExecuteQuery(sqlQuery));
            }
        }
Beispiel #4
0
        public static EAD_Project.Models.product_details GetUserById(string pid)
        {
            var query = String.Format("Select * from dbo.product_details Where name='{0}'", pid);

            using (DBHelper helper = new DBHelper())
            {
                var reader = helper.ExecuteReader(query);

                EAD_Project.Models.product_details dto = null;

                if (reader.Read())
                {
                    dto = FillDTO(reader);
                }

                return(dto);
            }
        }