protected void btnSave_Click(object sender, EventArgs e) { CategoryManager cm = new CategoryManager(); Category c = new Category(); c.Name = txtName.Text; c.Status = chkActive.Checked; if (QueryStringContains("ID")) { c.CategoryID = int.Parse(GetFromQueryString("ID")); cm.Update(c); } else cm.Create(c); Response.Redirect("Edit.aspx?ID=" + c.CategoryID); }
/// <summary> /// Creates the specified c. /// </summary> /// <param name="c">The c.</param> public void Create(Category c) { try { OpenSession(); Session.Save(c); } catch (Exception ex) { LogUtils.Log("Error updating single category", ex); throw ex; } finally { } }