public ActionResult Follow(int channelid, bool followed) { int res = 0; Follow follow = followmanager.Find(x => x.Channel.id == channelid && x.Owner.id == CurrentSession.User.id); Channel channel = channelmanager.Find(x => x.id == channelid); if (follow != null && followed == false) { res = followmanager.Delete(follow); } else if (follow == null && followed == true) { res = followmanager.Insert(new Follow() { CreatedOn = DateTime.Now, Channel = channel, Owner = CurrentSession.User }); } if (res > 0) { return(Json(new { hasError = false, errorMessage = string.Empty, result = channel.Follows.Count })); } return(Json(new { hasError = true, errorMessage = "Takip etme işlemi gerçekleştirilemedi.", result = channel.Follows.Count })); }