Beispiel #1
0
        public async Task <IActionResult> FollowAsync([FromBody] FollowViewModel followViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(Json(ModelState.DefaultInvalidModelStateWithErrorMessages()));
            }

            int                userId          = Convert.ToInt32(User.FindFirstValue(ClaimTypes.NameIdentifier));
            FollowerDto        follower        = followViewModel.GetFollowerDto(userId);
            ServiceResponseDto followResultDto = await _followerService.FollowUserAsync(follower);

            await _tempDataService.UpdateTempDataAsync(TempData, userId);

            return(Json(followResultDto));
        }