public async Task <ActionResult> RemovePost([FromServices] ISeminarPostService seminarPostService, int id, int pid) { Seminar seminar = await SeminarService.GetByIdAsync(id); Post post = await PostService.GetByIdAsync(pid); bool b = await seminarPostService.DeleteEntitySavedAsync(s => s.SeminarId == id && s.PostId == pid) > 0; return(ResultData(null, b, b ? $"已成功将【{post.Title}】从专题【{seminar.Title}】移除" : "添加失败!")); }
/// <summary> /// 专题页 /// </summary> /// <param name="seminarService"></param> /// <param name="postService"></param> /// <param name="seminarPostService"></param> public SeminarController(ISeminarService seminarService, IPostService postService, ISeminarPostService seminarPostService) { SeminarService = seminarService; PostService = postService; _seminarPostService = seminarPostService; }