/// <summary> /// 查询上一篇下一篇 /// </summary> /// <param name="id"></param> /// <param name="condition"></param> /// <returns></returns> public UpNextDto SelectContext(int id, ArticleCondition condition = null) { IEnumerable <dynamic> dynamics = _articleRepoistory.SelectContext(id, ConvertCondition(condition)); UpNextDto pageInfoMode = new UpNextDto(); foreach (dynamic d in dynamics) { if (d.article_id > id) { pageInfoMode.NextId = d.article_id; pageInfoMode.NextTitle = d.article_title; } else { pageInfoMode.BeforeId = d.article_id; pageInfoMode.BeforeTitle = d.article_title; } } return(pageInfoMode); }
public ApiResult GetUpNext(int id) { UpNextDto upNextDto = _articleService.SelectContext(id); return(ApiResult.Success(upNextDto)); }