/// <summary> /// 查询单个 /// </summary> /// <param name="id"></param> /// <returns>存在返回model,否则返回null</returns> public Tag GetById(string id) { Tag model = new Tag(); DataTable dt = dataBase.GetOnlyById4MySql(id, model).Tables[0]; if (dt != null && dt.Rows.Count > 0) { return FillData.FillDataToEntity(model, dt); } else { return null; } }
public ActionResult Insert(Tag tag) { var model = new Tag { Id = Guid.NewGuid().ToString("N"), TagName = tag.TagName, CreateTime = DateTime.Now, CreateUser = CUR_USER.UserName, ModifyTime = DateTime.Now, ModifyUser = CUR_USER.UserName }; if (_ITagService.Insert(model)) { return new ActionReturn(true); } return new ActionReturn(false); }
/// <summary> /// 添加标签 /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool Insert(Tag entity) { if (entity != null) { string sql = FillData.AppendSqlToInsert(entity); MySqlCommand cmd = new MySqlCommand(sql, DataBase.GetOpenConn4MySql()); MySqlParameter[] para = FillData.AppendParas(entity); cmd.Parameters.AddRange(para); int result = cmd.ExecuteNonQuery(); if (result > 0) { return true; } return false; } else { return false; } }
public int Update(Tag model) { throw new NotImplementedException(); }
public bool Insert(Tag entity) { return _ITagDao.Insert(entity); }