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

            int                userId            = Convert.ToInt32(User.FindFirstValue(ClaimTypes.NameIdentifier));
            FollowerDto        follower          = unFollowViewModel.GetFollowerDto(userId);
            ServiceResponseDto unFollowResultDto = await _followerService.UnFollowUserAsync(follower);

            await _tempDataService.UpdateTempDataAsync(TempData, userId);

            return(Json(unFollowResultDto));
        }