public IActionResult AddUserToFollow(int userId) { if (_workContext.CurrentCustomer.IsRegistered()) { var user = _customerContext.GetCustomerById(userId); if (user == null) { return(Ok(new { status = false })); } var postFollow = new Z_Harag_Follow { FollowType = (int)FollowType.User, FollowedId = user.Id, CreatedTime = DateTime.Now, UpdatedTime = DateTime.Now, UserId = _workContext.CurrentCustomer.Id }; // check if user exists var exists = _followRepository.IsUserFollowed(user.Id, _workContext.CurrentCustomer.Id); if (exists) { _followRepository.RemoveUserFromFollow(user.Id, _workContext.CurrentCustomer.Id); return(Ok(new { status = true, added = false })); } var follow = _followRepository.AddUserToFollow(postFollow); return(Ok(new { status = true, added = true })); } return(Ok(new { status = false })); }