public IActionResult GetOne([FromBody] IdVModel param) { var result = new TResultModel <AuthorVModel>(1); return(this.Wrapper(ref result, () => { var author = _authorRepository.GetById(param.Id); if (author == null) { result.ResultNo = -1; result.Message = "未找到该作者"; return; } result.TModel = new AuthorVModel() { id = author.Id, email = author.Email, gzOpenId = author.GzOpenId, icon = author.Icon, isDel = author.IsDel, miniOpenId = author.MiniOpenId, mobile = author.Mobile, motto = author.Motto, name = author.Name, qrCode = author.QrCode }; }, true)); }
public IActionResult GetOne([FromBody] IdVModel param) { var result = new TResultModel <BlogVModel>(1); return(this.Wrapper(ref result, () => { var blog = _blogRepository.GetById(param.Id); if (blog == null) { result = new TResultModel <BlogVModel>(-1, "未找到该文章"); return; } var category = _categoryRepository.GetById(blog.CategoryId); var author = _authorRepository.GetById(blog.AuthorId); result.TModel = new BlogVModel() { id = blog.Id, authorId = blog.AuthorId, status = blog.Status, categoryId = blog.CategoryId, content = blog.Content, isDel = blog.IsDel, name = blog.Name, createDate = blog.CreateDate, categoryName = category?.Name, authorName = author?.Name, isTop = blog.IsTop }; }, true)); }
public IActionResult Remove([FromBody] IdVModel param) { var result = new ResultModel(); return(this.Wrapper(ref result, () => { _blogCommentRepository.Delete(param.Id); }, true)); }