コード例 #1
0
        public async Task <IActionResult> Follow(int?id)
        {
            var user = await _userManager.GetUserAsync(User);

            if (!await _followerService.Follow(user, id))
            {
                return(BadRequest());
            }

            return(Json(new { }));
        }
コード例 #2
0
        public HttpResponseMessage Follow(string profileId)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            SuccessResponse response = new SuccessResponse();
            string          userId   = _userService.GetCurrentUserId();

            _followerSevice.Follow(userId, profileId);

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
コード例 #3
0
 public IActionResult Add(string followedUserId)
 {
     followers.Follow(User.Identity.Name, followedUserId);
     return(RedirectToAction("Index", "User", new { id = followedUserId }));
 }