BlogEngine.Core.Providers.DbBlogProvider.DeleteBlog C# (CSharp) Method

DeleteBlog() public method

Deletes a Blog from the database
public DeleteBlog ( Blog blog ) : void
blog Blog /// The blog. ///
return void
        public override void DeleteBlog(Blog blog)
        {
            // Only deleting data from be_Blogs.  Data from the other tables
            // will be deleted in DeleteBlogStorageContainer().
            using (TransactionScope ts = new TransactionScope())
            {
                using (var conn = this.CreateConnection())
                {
                    if (conn.HasConnection)
                    {
                        var sqlQuery = string.Format("DELETE FROM {0}Blogs WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                        using (var cmd = conn.CreateTextCommand(sqlQuery))
                        {
                            cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
                            cmd.ExecuteNonQuery();
                        }

                    }
                }
                ts.Complete();
            }
        }