Пример #1
0
        public ActionResult Index(string search)
        {
            string  userId       = Session["UserId"].ToString();
            TweetVM tweetVM      = new Models.TweetVM();
            string  queryString  = Request.QueryString["search"];
            Search  searchResult = new Search();

            if (string.IsNullOrEmpty(queryString))
            {
                if (Session["UserName"] != null)
                {
                    // TODO:: Get the list of tweets from the logged in user and his followings
                    tweetVM.Tweets     = tweetBL.GetTweets(userId);
                    tweetVM.NoOfTweets = tweetBL.GetUserTweetCount(userId);
                    tweetVM.Following  = tweetBL.GetUserFollowingCount(userId);
                    tweetVM.Followers  = tweetBL.GetUserFollowersCount(userId);
                    return(View(tweetVM));
                }
                else
                {
                    return(RedirectToAction("Login", "User"));
                }
            }
            else
            {
                //TODO:: Send the username with userid to Modal dialog where user can do FOLLOW and UNFOLLOW
                Person objPerson = userBL.SearchUser(queryString);
                if (objPerson != null)
                {
                    searchResult.showDialog = true;
                }
                return(PartialView("_PartialSearchDialog", objPerson));
                //return RedirectToAction("Index", "Home", searchResult);
            }
        }
        public ActionResult Index(string search)
        {
            string userId    = Session["UserId"].ToString();
            string searchVal = Request.QueryString["search"];

            TweetVM tweetData    = new TweetVM();
            Search  searchResult = new Search();

            if (string.IsNullOrEmpty(searchVal))
            {
                if (Session["UserName"] != null)
                {
                    tweetData.Tweets     = tbl.GetTweets(userId);
                    tweetData.Following  = tbl.GetUserFollowingCount(userId);
                    tweetData.Followers  = tbl.GetUserFollowersCount(userId);
                    tweetData.NoOfTweets = tbl.GetUserTweetCount(userId);
                    return(View(tweetData));
                }
                else
                {
                    return(RedirectToAction("Login", "User"));
                }
            }
            else
            {
                Person person = ubl.SearchUser(searchVal);
                if (person != null)
                {
                    searchResult.showDialog = true;
                }
                return(PartialView("_PartialSearchDialog", person));
            }
        }
Пример #3
0
        public IList <TweetDTO> GetUserTweets(int id)
        {
            IList <TweetDTO> listOfTweets = new List <TweetDTO>();

            listOfTweets = TweetBL.GetTweets(id);

            return(listOfTweets);
        }