Ejemplo n.º 1
0
 public ActionResult Follow(UserSearch usrSrch)
 {
     try
     {
         UserHomeModel um               = new UserHomeModel();
         UsersHandler  usrHandlr        = new UsersHandler();
         IEnumerable <UserFollowing> uf = null;
         uf = usrHandlr.GetFollowingList(usrSrch.sourceUsrID);
         foreach (var usrFollow in uf)
         {
             if (usrFollow.FollowingUser_ID == usrSrch.ID)
             {
                 throw new Exception("You are already following this user");
             }
         }
         if (usrHandlr.FollowUser(usrSrch.sourceUsrID, usrSrch.ID))
         {
             User usr = new User();
             usr = usrHandlr.GetUserDetails(usrSrch.sourceUsrID);
             return(RedirectToAction("Home", "UserHome", usr));
         }
         return(Redirect(Request.UrlReferrer.ToString()));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
         return(Redirect(Request.UrlReferrer.ToString()));
     }
 }
Ejemplo n.º 2
0
        public ActionResult FollowerPage(int ID)
        {
            UserHomeModel um        = new UserHomeModel();
            UsersHandler  usrHandlr = new UsersHandler();

            um.user          = usrHandlr.GetUserDetails(ID);
            um.FollowersList = usrHandlr.GetFollowersList(ID);
            um.FollowingList = usrHandlr.GetFollowingList(ID);
            return(View(um));
        }
Ejemplo n.º 3
0
        // GET: UserHome
        public ActionResult Home(User user)
        {
            UserHomeModel um = new UserHomeModel();

            um.user = user;
            TweetHandler twtHandlr = new TweetHandler();

            um.tweetDetails = twtHandlr.GetAllTweets(user.ID);
            UsersHandler usrHandlr = new UsersHandler();

            um.FollowersList = usrHandlr.GetFollowersList(user.ID);
            um.FollowingList = usrHandlr.GetFollowingList(user.ID);
            return(View(um));
        }