public override void UpdateCategory(Category category)
{
var categories = Category.Categories;
categories.Remove(category);
categories.Add(category);
categories.Sort();
using (var conn = this.CreateConnection())
{
if (conn.HasConnection)
{
var sqlQuery = string.Format("UPDATE {0}Categories SET CategoryName = {1}catname, Description = {1}description, ParentID = {1}parentid WHERE BlogID = {1}blogid AND CategoryID = {1}catid", this.tablePrefix, this.parmPrefix);
using (var cmd = conn.CreateTextCommand(sqlQuery))
{
var p = cmd.Parameters;
p.Add(conn.CreateParameter(FormatParamName("blogid"), Blog.CurrentInstance.Id.ToString()));
p.Add(conn.CreateParameter(FormatParamName("catid"), category.Id.ToString()));
p.Add(conn.CreateParameter(FormatParamName("catname"), category.Title));
p.Add(conn.CreateParameter(FormatParamName("description"), category.Description));
p.Add(conn.CreateParameter(FormatParamName("parentid"), (category.Parent == null ? (object)DBNull.Value : category.Parent.ToString())));
cmd.ExecuteNonQuery();
}
}
}
}