public async Task <ResponseMessage> SetAsBookmarked([FromBody] BookmarkUserViewModel model) { //get current user from jwt token var userName = HttpContext?.User.Claims.FirstOrDefault(c => c.Type == System.Security.Claims.ClaimTypes.NameIdentifier).Value; var user = await _userManager.FindByNameAsync(userName); var Bookmarked = _appUserService.CheckIfIsBookmarkedUser(user.Id, model.Id); if (model.IsBookmarked == true) { if (Bookmarked) { return new ResponseMessage { Message = "User has been already bookmarked", IsSuccess = false } } ; _appUserService.BookmarkedUser(new BookmarkedUserViewModel { AppUserId = user.Id, BookmarkedAppUserId = model.Id }); return(new ResponseMessage { IsSuccess = true, Message = "User is bookmarked" }); } else { if (!Bookmarked) { return new ResponseMessage { Message = "User is not bookmarked", IsSuccess = false } } ; _appUserService.UnBookmarkedUser(new BookmarkedUserViewModel { AppUserId = user.Id, BookmarkedAppUserId = model.Id }); return(new ResponseMessage { IsSuccess = true, Message = "User is un bookmarked" }); } }