public JsonResult AddFollower(FollowingEntity follower) { follower.user_id = Session["UserName"].ToString(); var response = _ITwitterClone.AddFollower(follower); return(Json(response, JsonRequestBehavior.AllowGet)); }
protected virtual void GetHealthBar() { _healthBar = Instantiate(GameObject.Find("HealthBar")); UnityEngine.UI.Text text = _healthBar.GetComponent <UnityEngine.UI.Text>(); text.text = new string('-', _health / 10); text.enabled = true; FollowingEntity script = _healthBar.GetComponent <FollowingEntity>(); script.followedEntity = transform; script.enabled = true; _healthBar.transform.SetParent(GameObject.Find("Canvas").transform); }
public ActionResult Index() { ViewBag.IsAuthenticated = true; PersonEntity person = new PersonEntity(); person.user_id = Session["UserName"].ToString(); FollowingEntity follower = new FollowingEntity(); follower.user_id = Session["UserName"].ToString(); ViewBag.FollwerCount = _ITwitterClone.GetFollowerDetails(follower).Count.ToString(); ViewBag.FollwingCount = _ITwitterClone.GetFollowingDetails(follower).Count.ToString(); var tweets = _ITwitterClone.GetTweetsDetails(person); ViewData["TweetData"] = tweets; ViewBag.TweetsCount = tweets.Count.ToString(); return(View()); }
public string AddFollower(FollowingEntity followerDetails) { try { var person = new FOLLOWING() { user_id = followerDetails.user_id, following_id = followerDetails.following_id }; using (var Connection = new TwitterApplicationEntities()) { Connection.FOLLOWINGs.Add(person); Connection.SaveChanges(); } return("Follower Added Successfully"); } catch (Exception exception) { throw new Exception(exception.Message.ToString(), exception); } }
public async Task <bool> Follow(int userId, int followingUserId) { var relation = await _db.UserRelationshipEntities.FirstOrDefaultAsync( x => x.UserId == userId && x.FollowingId == followingUserId); if (relation == null) { relation = new FollowingEntity { UserId = userId, FollowingId = followingUserId, VisitsCount = 0, IsFollowing = true, FollowingDate = DateTime.UtcNow, LastVisitDate = DateTime.UtcNow }; _db.UserRelationshipEntities.Add(relation); } relation.IsFollowing = true; return(await _db.SaveChangesAsync() > 0); }
public List <FollowingEntity> GetFollowerDetails(FollowingEntity followerDetails) { try { List <FollowingEntity> poDetails; using (var Connection = new TwitterApplicationEntities()) { poDetails = (from p in Connection.FOLLOWINGs where p.following_id == followerDetails.user_id select new FollowingEntity { user_id = p.user_id, following_id = p.following_id }).ToList(); } return(poDetails); } catch (Exception exception) { throw new Exception(exception.Message.ToString(), exception); } }
private string GetInsertionFollowLine(FollowingEntity follow) { var isFollowing = 1;// follow.IsFollowing ? 1 : 0; return($"({follow.UserId}, {follow.FollowingId}, {follow.VisitsCount}, {isFollowing}, '{follow.FollowingDate:u}', '{follow.LastVisitDate:u}')"); }
public string AddFollower(FollowingEntity followerDetails) { return(_ITwitterClone.AddFollower(followerDetails)); }
public List <FollowingEntity> GetFollowingDetails(FollowingEntity followerDetails) { return(_ITwitterClone.GetFollowingDetails(followerDetails)); }