Exemplo n.º 1
0
        public string Put(landingpagephp ldp)
        {
            try
            {
                string query = @"
                    update dbo.LandingPagePhp set 
                     landingpage_name='" + ldp.landingpage_name + @"'
 ,landingpage_email='" + ldp.landingpage_email + @"'
                    ,landingpage_phone='" + ldp.landingpage_phone + @"'
                    ,landingpage_note='" + ldp.landingpage_note + @"'
                    
                    where landingpage_id=" + ldp.landingpage_id + @"
                    ";

                DataTable table = new DataTable();
                using (var con = new SqlConnection(ConfigurationManager.
                                                   ConnectionStrings["LandingPage"].ConnectionString))
                    using (var cmd = new SqlCommand(query, con))
                        using (var da = new SqlDataAdapter(cmd))
                        {
                            cmd.CommandType = CommandType.Text;
                            da.Fill(table);
                        }

                return("Updated Successfully!!");
            }
            catch (Exception)
            {
                return("Failed to Update!!");
            }
        }
Exemplo n.º 2
0
        public string Post(landingpagephp ldp)
        {
            try
            {
                string query = @"
                    insert into dbo.LandingPagePhp values
                    ( '" + ldp.landingpage_name + @"'
 ,'" + ldp.landingpage_email + @"'
                    ,'" + ldp.landingpage_phone + @"'
                    ,'" + ldp.landingpage_note + @"'
                    )
                    ";

                DataTable table = new DataTable();
                using (var con = new SqlConnection(ConfigurationManager.
                                                   ConnectionStrings["LandingPage"].ConnectionString))
                    using (var cmd = new SqlCommand(query, con))
                        using (var da = new SqlDataAdapter(cmd))
                        {
                            cmd.CommandType = CommandType.Text;
                            da.Fill(table);
                        }

                return("Đăng Ký Thàng Công !!! " +
                       "Trung Tâm Sẽ Liên Hệ Tới Bạn Trong Thời Gian Sớm Nhất");
            }
            catch (Exception)
            {
                return("Vui Lòng Đăng Ký Lại");
            }
        }