Beispiel #1
0
        public ActionResult SearchProfile(string SearchText)
        {
            Session["SearchText"] = SearchText;
            var ProfList = new List <Profile>();
            var LikeList = new List <int>();

            string[] usernames = GetUsers(SearchText);

            Like likeModel = new Like();

            if (usernames != null)
            {
                for (int i = 0; i < usernames.Length; i++)
                {
                    ProfList.Add(profcontroller.ReturnProfile(usernames[i]));
                    int LikeCounter = likeModel.LikeCount(usernames[i]);
                    System.Diagnostics.Debug.WriteLine(String.Format("# of likes for {0}: {1}", usernames[i], LikeCounter));
                    LikeList.Add(LikeCounter);
                }
                ViewBag.Message = ProfList;
            }
            else
            {
                ViewBag.Message = null;
            }
            ViewBag.ListCount = LikeList;

            return(View());
        }
        public ActionResult SingleProfileView(string Username)
        {
            System.Diagnostics.Debug.WriteLine(Username + " inside SPVC");
            string SingleUser = Username;

            Profile SingleProf = new Profile();
            int     Likes      = 0;
            Like    likeModel  = new Like();
            bool    LikeStat;

            SingleProf      = ReturnProfile(SingleUser);
            Likes           = likeModel.LikeCount(SingleUser);
            ViewBag.Likes   = Likes;
            ViewBag.Profile = SingleProf;
            LikeStat        = likeModel.LikeUnlike(Username, Session["Username"].ToString());
            if (LikeStat == true)
            {
                ViewBag.LikeStat = "Like";
            }
            else
            {
                ViewBag.LikeStat = "Unlike";
            }
            return(View());
        }