private void EditAssoType(HttpContext context) { int itemid = Convert.ToInt32(context.Request["ItemId"]); string name = context.Request["Name"]; jsonModel = bll.IsNameExists(name, itemid); if (jsonModel.errNum == 0) { if (jsonModel.retData.ToString().ToLower() == "true") { jsonModel = new JsonModel() { errNum = -1, errMsg = "exist", retData = "" }; } else { jsonModel = bll.GetEntityById(itemid); if (jsonModel.errNum == 0) { Asso_Type item = jsonModel.retData as Asso_Type; item.Id = itemid; item.Name = name; item.EditUID = context.Request["LoginUID"]; item.EditTime = DateTime.Now; jsonModel = bll.Update(item); } } } }
private void AddAssoType(HttpContext context) { string name = context.Request["Name"]; jsonModel = bll.IsNameExists(name); if (jsonModel.errNum == 0) { if (jsonModel.retData.ToString().ToLower() == "true") { jsonModel = new JsonModel() { errNum = -1, errMsg = "exist", retData = "" }; } else { Asso_Type item = new Asso_Type(); item.Name = name; item.CreateUID = context.Request["LoginUID"]; item.CreateTime = DateTime.Now; jsonModel = bll.Add(item); } } }