public IHttpActionResult Update(BlogParameter parameter) { var dto = this._mapper.Map <BlogDto>(parameter); this._blogService.Update(dto); return(Ok()); }
public async Task <bool> UpdateAsync([FromBody] BlogParameter parameter) { // Convert BlogParameter to BlogQueryDto var blogDto = this._mapper.Map <BlogDto>(parameter); var status = await this._blogService.UpdateAsync(blogDto); return(status); }
public IQueryable <BlogInfo> GetBlogList(BlogParameter parameter) { var list = base.GetListByPage(parameter); if (!string.IsNullOrEmpty(parameter.AuthorId))// && Guid.TryParse(parameter.AuthorId, out userId)) { list = list.Where(b => b.AuthorId == parameter.AuthorId); } return(list); }
public ActionResult Index() { var parameter = new BlogParameter() { AuthorId = CurrentUser.Id, PageIndex = RequestHelper.Query("p").ToInt(0), PageSize = 20 }; var list = _blogService.GetBlogList(parameter).ToList(); return(View(list)); }
public IHttpActionResult Add(BlogParameter parameter) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var dto = this._mapper.Map <BlogDto>(parameter); this._blogService.Add(dto); return(Ok()); }
public JsonResult GetList() { var parameter = new BlogParameter() { PageIndex = RequestHelper.Query("p").ToInt(0), PageSize = RequestHelper.Query("s").ToInt(0), OrderBy = RequestHelper.Query("orderby"), IsAsc = RequestHelper.Query("sort").ToLower().Equals("asc"), }; var profiler = MiniProfiler.Current; using (profiler.Step("查询博客列表")) { var list = new List <BlogModel>().Bind(_blogService.GetBlogList(parameter), parameter.RecordCount); return(Json(new { Items = list, TotalCount = parameter.RecordCount }, JsonRequestBehavior.AllowGet)); } }
public IQueryable <BlogInfo> GetBlogList(BlogParameter parameter) { var result = _blogRepository.GetBlogList(parameter); return(result); }