/** * 编辑文章 * * @param contents 文章对象 */ public void updateArticle(ContentInput contents) { contents.Modified = DateTime.Now; contents.Tags = contents.Tags ?? ""; contents.Categories = contents.Categories ?? ""; var entity = new Contents(); _mapper.Map(contents, entity); var cid = _repository.InsertOrUpdateAndGetId(entity); var tags = contents.Tags; var categories = contents.Categories; if (null != contents.Type && !contents.Type.Equals(Types.PAGE)) { _relationshipService.DeleteByContentId(cid); } _metasService.saveMetas(cid, tags, Types.TAG); _metasService.saveMetas(cid, categories, Types.CATEGORY); }