示例#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 { }));
        }
        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 }));
 }