public int SuaBaiViet(BaiViet obj)
        {
            SqlParameter p0  = new SqlParameter("@MaBaiViet", obj.MaBaiViet);
            SqlParameter p1  = new SqlParameter("@TieuDe", obj.TieuDe);
            SqlParameter p2  = new SqlParameter("@ChuyenMuc", obj.ChuyenMuc);
            SqlParameter p3  = new SqlParameter("@MoTaNgan", obj.MoTaNgan);
            SqlParameter p4  = new SqlParameter("@HinhAnh", obj.HinhAnh);
            SqlParameter p5  = new SqlParameter("@ThongTinChiTiet", obj.ThongTinChiTiet);
            SqlParameter p8  = new SqlParameter("@DacSan", obj.DacSan);
            SqlParameter p9  = new SqlParameter("@GiaBan", obj.GiaBan);
            SqlParameter p10 = new SqlParameter("@TrangThai", obj.TrangThai);

            SqlParameter[] sqlParams = { p0, p1, p2, p3, p4, p5, p8, p9, p10 };
            return(dl.SaveChanges("UPDATE [dbo].[tblBaiViet] SET [TieuDe] = @TieuDe,[ChuyenMuc] = @ChuyenMuc,[MoTaNgan] = @MoTaNgan,[HinhAnh] = @HinhAnh,[ThongTinChiTiet] = @ThongTinChiTiet,[DacSan] = @DacSan,[GiaBan] = @GiaBan,[TrangThai] = @TrangThai WHERE [MaBaiViet] = @MaBaiViet", sqlParams));
        }
        //public int ThemBaiViet(BaiViet obj)
        //{
        //    SqlParameter p1 = new SqlParameter("@TieuDe", obj.TieuDe);
        //    SqlParameter p2 = new SqlParameter("@ChuyenMuc", obj.ChuyenMuc);
        //    SqlParameter p3 = new SqlParameter("@MoTaNgan", obj.MoTaNgan);
        //    SqlParameter p4 = new SqlParameter("@HinhAnh", obj.HinhAnh);
        //    SqlParameter p5 = new SqlParameter("@ThongTinChiTiet", obj.ThongTinChiTiet);
        //    SqlParameter p6 = new SqlParameter("@NgayViet", obj.NgayViet);
        //    SqlParameter p7 = new SqlParameter("@NguoiViet", obj.NguoiViet);
        //    SqlParameter p8 = new SqlParameter("@DacSan", obj.DacSan);
        //    SqlParameter p9 = new SqlParameter("@GiaBan", obj.GiaBan);
        //    SqlParameter p10 = new SqlParameter("@TrangThai", obj.TrangThai);
        //    SqlParameter p11 = new SqlParameter("@LuotXem", obj.LuotXem);
        //    SqlParameter[] sqlParams = { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 };
        //    return dl.SaveChanges("INSERT INTO [dbo].[tblBaiViet]([TieuDe],[ChuyenMuc],[MoTaNgan],[HinhAnh],[ThongTinChiTiet],[NgayViet],[NguoiViet],[DacSan],[GiaBan],[TrangThai],[LuotXem]) VALUES (@TieuDe,@ChuyenMuc,@MoTaNgan,@HinhAnh,@ThongTinChiTiet,@NgayViet,@NguoiViet,@DacSan,@GiaBan,@TrangThai,@LuotXem)", sqlParams);
        //}
        public int ThemBaiViet(BaiViet obj)
        {
            SqlParameter p1  = new SqlParameter("@TieuDe", obj.TieuDe);
            SqlParameter p2  = new SqlParameter("@ChuyenMuc", obj.ChuyenMuc);
            SqlParameter p3  = new SqlParameter("@MoTaNgan", obj.MoTaNgan);
            SqlParameter p4  = new SqlParameter("@HinhAnh", obj.HinhAnh);
            SqlParameter p5  = new SqlParameter("@ThongTinChiTiet", obj.ThongTinChiTiet);
            SqlParameter p7  = new SqlParameter("@NguoiViet", obj.NguoiViet);
            SqlParameter p8  = new SqlParameter("@DacSan", obj.DacSan);
            SqlParameter p9  = new SqlParameter("@GiaBan", obj.GiaBan);
            SqlParameter p10 = new SqlParameter("@TrangThai", obj.TrangThai);

            SqlParameter[] sqlParams = { p1, p2, p3, p4, p5, p7, p8, p9, p10 };
            return(dl.SaveChanges("INSERT INTO [dbo].[tblBaiViet]([TieuDe],[ChuyenMuc],[MoTaNgan],[HinhAnh],[ThongTinChiTiet],[NguoiViet],[DacSan],[GiaBan],[TrangThai]) VALUES (@TieuDe,@ChuyenMuc,@MoTaNgan,@HinhAnh,@ThongTinChiTiet,@NguoiViet,@DacSan,@GiaBan,@TrangThai)", sqlParams));
        }