Exemplo n.º 1
0
        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 }));
        }
Exemplo n.º 2
0
    protected void BTNoff_Click(object sender, EventArgs e)
    {
        LinkButton follow_id = (LinkButton)sender;
        Follow     fw        = new Follow();

        fw.accountId = new Guid(follow_id.CommandArgument);
        Guid fan_id;

        fan_id   = new Guid(Request.Cookies["account_id"].Value);
        fw.fanId = fan_id;
        FollowManager fm = new FollowManager();

        if (fm.Delete(fw))
        {
            Response.Redirect("Followlist.aspx");
        }
    }