Ejemplo n.º 1
0
        public ActionResult AddStoreFollow(int ID)
        {
            if (User.Identity.IsAuthenticated == false)
            {
                return(Json("You must login to Follow", JsonRequestBehavior.AllowGet));
            }
            UserProfile user = UserProfiles_Logic.GetUserProfileByUserName(User.Identity.Name);
            Follow      temp = new Follow();

            temp.UserId  = user.UserId;
            temp.StoreId = ID;

            if (Follow_Logic.AddNewFollow(temp))
            {
                Store store = db.Stores.Find(ID);
                ++store.TotalFollowers;
                db.Entry(store).State = EntityState.Modified;
                db.SaveChanges();

                // Publish Message
                Message_Logic.PublishMessage(WebSecurity.CurrentUserId, Constant.PRONOUN_TYPE_USER, ID, Constant.PRONOUN_TYPE_STORE, Constant.MESSAGE_TYPE_FOLLOW);
                return(Json("true", JsonRequestBehavior.AllowGet));
            }
            return(Json("false", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public ActionResult AddUserFollow(int ID)
        {
            if (User.Identity.IsAuthenticated == false)
            {
                return(Json("You must login to Like", JsonRequestBehavior.AllowGet));
            }
            Follow temp = new Follow();

            temp.UserId         = WebSecurity.CurrentUserId;
            temp.FollowedUserId = ID;
            if (Follow_Logic.AddNewFollow(temp))
            {
                // Publish Message
                Message_Logic.PublishMessage(WebSecurity.CurrentUserId, Constant.PRONOUN_TYPE_USER, ID, Constant.PRONOUN_TYPE_USER, Constant.MESSAGE_TYPE_FOLLOW);
                return(Json("true", JsonRequestBehavior.AllowGet));
            }
            return(Json("false", JsonRequestBehavior.AllowGet));
        }