public async Task <PageResponse> Get(PageRequest request) { var page = await _dataSrv.GetAsync(request.PageId); if (!HasAccessToSee(page, request.RequestOwner)) { return(UnauthorizedRequest()); } return(new PageResponse() { Access = ResponseAccess.Granted, Page = page.MapForShowViewModel() }); }
public async Task <CommentDetailResponse> GetDetial(CommentDetailRequest request) { var comment = await _commentData.GetAsync(request.Id); switch (comment.TargetType) { case CommentTargetType.Entity: return(new CommentDetailResponse() { Access = ResponseAccess.Granted, Comment = comment.MapToViewModelWithTarget(await _entityDataService.Query.Include(x => x.Scheme).FirstAsync(x => x.Id == comment.TargetId)) }); case CommentTargetType.Page: return(new CommentDetailResponse() { Access = ResponseAccess.Granted, Comment = comment.MapToViewModelWithTarget(await _pageDataService.GetAsync(comment.TargetId)) }); case CommentTargetType.Undefined: default: return(new CommentDetailResponse() { Access = ResponseAccess.BadRequest }); } }