Example #1
0
 public ActionResult Account()
 {
     ViewBag.Notifications = myProfile.GetNotification(Convert.ToInt32(Session["ID"]));
     if (Session["Email"] == null)
     {
         if (HttpContext.Request.Cookies.Get("Cookie") == null)
         {
             return(RedirectToAction("SignIn", "SignIn"));
         }
         else
         {
             string data  = SignInLogic.Decrypt(HttpContext.Request.Cookies.Get("Cookie").Value);
             string email = string.Empty;
             for (int i = 0; i < data.Length; i++)
             {
                 if (data[i] == ' ')
                 {
                     break;
                 }
                 email += (data[i]);
             }
             string name = myProfile.GetUser(email).Name;
             Session["Name"]         = name;
             Session["Email"]        = email;
             Session["ImageProfile"] = myProfile.GetImage(Session["Email"].ToString());
             ViewBag.Notifications   = myProfile.GetNotification(Convert.ToInt32(Session["ID"]));
             return(View(signIn.GetUserById(Session["ID"].ToString())));
         }
     }
     else
     {
         return(View(signIn.GetUserById(Session["ID"].ToString())));
     }
 }
        public ActionResult Contacts()
        {
            int id = Convert.ToInt32(Session["ID"]);

            ViewBag.Notifications = myProfile.GetNotification(id);
            return(View(chat.GetContacts(id)));
        }
 public ActionResult Feed()
 {
     ViewBag.Notifications = myProfile.GetNotification(Convert.ToInt32(Session["ID"]));
     ViewBag.Posts         = feed.GetPosts(Convert.ToInt32(Session["ID"]));
     ViewBag.Likes         = myProfile.Likes();
     return(View(myProfile.GetUser(Session["Email"].ToString())));
 }
        public ActionResult MyProfile()
        {
            if (Session["Email"] == null)
            {
                if (HttpContext.Request.Cookies.Get("Cookie") == null)
                {
                    return(RedirectToAction("SignIn", "SignIn"));
                }
                else
                {
                    string data  = SignInLogic.Decrypt(HttpContext.Request.Cookies.Get("Cookie").Value);
                    string email = string.Empty;
                    for (int i = 0; i < data.Length; i++)
                    {
                        if (data[i] == ' ')
                        {
                            break;
                        }
                        email += (data[i]);
                    }
                    string name = myProfile.GetUser(email).Name;
                    Session["Name"]  = name;
                    Session["Email"] = email;
                    Session["ID"]    = myProfile.GetUser(Session["Email"].ToString()).ID;

                    return(View(myProfile.GetUser(email)));
                }
            }

            Session["ID"]           = myProfile.GetUser(Session["Email"].ToString()).ID;
            Session["ImageProfile"] = myProfile.GetImage(Session["Email"].ToString());
            Session["Name"]         = myProfile.GetUser(Session["Email"].ToString()).Name;
            ViewBag.Following       = user.GetFollowing(myProfile.GetUser(Session["Email"].ToString()).ID);
            ViewBag.Followers       = user.GetFollowers(myProfile.GetUser(Session["Email"].ToString()).ID);
            ViewBag.Likes           = myProfile.Likes();
            ViewBag.Posts           = myProfile.Posts(myProfile.GetUser(Session["Email"].ToString()).ID);
            ViewBag.Notifications   = myProfile.GetNotification(Convert.ToInt32(Session["ID"]));
            return(View(myProfile.GetUser(Session["Email"].ToString())));
        }
        public new ActionResult User(int ID)
        {
            string email = user.GetUserEmail(ID);

            if (Session["Email"] == null)
            {
                return(RedirectToAction("SignIn", "SignIn"));
            }
            ViewBag.Following     = user.GetFollowing(myProfile.GetUser(email).ID);
            ViewBag.Followers     = user.GetFollowers(myProfile.GetUser(email).ID);
            Session["Name"]       = myProfile.GetUser(Session["Email"].ToString()).Name;
            Session["ID"]         = myProfile.GetUser(Session["Email"].ToString()).ID;
            ViewBag.IsFollowed    = user.IsFollowed(myProfile.GetUser(email).ID, myProfile.GetUser(Session["Email"].ToString()).ID);
            ViewBag.Likes         = myProfile.Likes();
            ViewBag.Posts         = myProfile.Posts(myProfile.GetUser(email).ID);
            ViewBag.Notifications = myProfile.GetNotification(Convert.ToInt32(Session["ID"]));
            return(View(myProfile.GetUser(email)));
        }