private void ProcessForm(int categoryId, bool isDelete) { try { using (TransactionScope ts = new TransactionScope()) { CategoryBO objCategory = new CategoryBO(this.ObjContext); if (categoryId > 0) { objCategory.ID = categoryId; objCategory.GetObject(); objCategory.Name = this.txtCategoryName.Text; objCategory.Description = this.txtDescription.Text; if (isDelete) { objCategory.Delete(); } } else { objCategory.Name = this.txtCategoryName.Text; objCategory.Description = this.txtDescription.Text; objCategory.Add(); } this.ObjContext.SaveChanges(); ts.Complete(); } } catch (Exception ex) { //throw ex; } }