/// <summary> /// 添加或更新分类信息 /// </summary> /// <param name="model"></param> /// <returns>主键ID</returns> public static int Create(CategoryInfo model) { if (model.Id == 0) { //Insert int i = CategoryManage.Insert(model); model.Id = i; } else { //Update CategoryManage.Update(model); } return(model.Id); }
private void Update(Category category) { int isSaved = categoryManage.Update(category); if (isSaved > 0) { addOrUpdate = "Update"; UserStatusSave(category); MessageBox.Show("Update Successfull"); UpdateButton2.Visible = false; ShowAllData(); } else { MessageBox.Show("Something Wrong into Database"); } }