public async Task <IActionResult> HandlePin(string slug, bool value) { var token = GetToken(); var userId = LoginHelper.GetClaim(token, "UserId"); var post = await _postRepository.GetAll().Where(x => !x.IsDeleted && x.Slug == slug) .Include(x => x.Community).FirstOrDefaultAsync(); var isMod = await _communityUserRepository.GetAll().Where(x => x.UserId == Guid.Parse(userId) && x.Community.Slug == post.Community.Slug && x.IsAdmin) .FirstOrDefaultAsync(); if (isMod == null) { return(Unauthorized()); } var result = await _postAppService.HandlePin(slug, value); return(Ok(result)); }