public static bool UpdateAuthor(CoverAuthor model) { try { return(ArticleDal.UpdateAuthor(ProcessConnection.OpenMarketing, model)); } catch (Exception ex) { throw ex; } }
public static bool UpdateAuthor(SqlConnection conn, CoverAuthor model) { using (conn) { string updateSql = "UPDATE Marketing..tbl_CoverAuthor SET AuthorName=@AuthorName,AuthorPhone=@AuthorPhone,AuthorHead=@AuthorHead,[Description]=@Description WHERE PKID=@PKID"; var sqlParamsInfo = new SqlParameter[] { new SqlParameter("@AuthorName", model.AuthorName), new SqlParameter("@AuthorPhone", model.AuthorPhone), new SqlParameter("@AuthorHead", model.AuthorHead), new SqlParameter("@Description", model.Description), new SqlParameter("@PKID", model.PKID) }; int res = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, updateSql, sqlParamsInfo); return(res > 0); } }
public static bool AddAuthor(SqlConnection conn, CoverAuthor model) { using (conn) { string insertSql = "INSERT INTO Marketing..tbl_CoverAuthor(AuthorName, AuthorPhone, AuthorHead, [Description], CreateTime, IsDelete) VALUES(@AuthorName, @AuthorPhone, @AuthorHead, @Description, GETDATE(), @IsDelete)"; var sqlParamsInfo = new SqlParameter[] { new SqlParameter("@AuthorName", model.AuthorName), new SqlParameter("@AuthorPhone", model.AuthorPhone), new SqlParameter("@AuthorHead", model.AuthorHead), new SqlParameter("@Description", model.Description), new SqlParameter("@IsDelete", model.IsDelete) }; int res = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, insertSql, sqlParamsInfo); return(res > 0); } }