Пример #1
0
    public IActionResult get(string?page, string?q)
    {
        Pageable?           pageable = PageableUtil.convert(page);
        PaginatedList <Tag> tags     = tagService.GetAll(pageable);

        Response.Headers.Add("X-Data-Count", tags.TotalCount.ToString());
        return(Ok(tags));
    }
Пример #2
0
    public IActionResult get(string?page, string?q)
    {
        Pageable?pageable = PageableUtil.convert(page);
        PaginatedList <Category> posts = categoryService.GetAll(pageable);

        Response.Headers.Add("X-Data-Count", posts.TotalCount.ToString());
        return(Ok(posts));
    }
Пример #3
0
    public IActionResult getNotifications(string?page, bool all = false)
    {
        Pageable?pageable = PageableUtil.convert(page);
        var      userId   =
            int.Parse(
                httpContextAccessor.HttpContext?.User.FindFirstValue(ClaimTypes
                                                                     .NameIdentifier) ?? throw new Exception());
        PaginatedList <Notification> notifications;

        if (all)
        {
            notifications = notificationService.GetAllByUserId(userId, pageable);
        }
        else
        {
            notifications = notificationService.GetAllUnreadByUserId(userId, pageable);
        }

        return(Ok(notifications));
    }
Пример #4
0
    public IActionResult getCommentsForPost(string page, int postId)
    {
        Pageable?pageable = PageableUtil.convert(page);

        return(Ok(commentService.GetAllByPostId(postId, pageable)));
    }
Пример #5
0
    public IActionResult get(string?page, string?q)
    {
        Pageable?pageable = PageableUtil.convert(page);

        return(Ok(postService.GetAll(pageable)));
    }