public async Task <IEnumerable <UserTossListViewResult> > Handle(UserTossListViewQuery request, CancellationToken cancellationToken) { List <UserTossListViewResult> list = await _session.Query <TossEntity>() .Where(t => t.UserName == request.UserName) .OrderByDescending(t => t.CreatedOn) .Select(t => new UserTossListViewResult() { Content = t.Content.Substring(0, 100), CreatedOn = t.CreatedOn, Id = t.Id, Tags = t.Tags }) .Paginate(request.Page, TossLastQuery.TossPerPage) .ToListAsync(); foreach (var item in list) { item.Id = ravenDBIdUtil.GetUrlId(item.Id); } return(list); }
public async Task <IActionResult> User([FromRoute] UserTossListViewQuery query) { var result = await _mediator.Send(query); return(base.Ok(result)); }