public ActionResult PersTweet(string name) { SecurityService.Session = System.Web.HttpContext.Current.Session; SecurityService.Users = new EfModelRepository { }; if (!SecurityService.IsAuthenticated) { return(RedirectToAction("Index")); } else { SecurityService.Session = System.Web.HttpContext.Current.Session; SecurityService.Users = new EfModelRepository { }; if (SecurityService.IsAuthenticated) { PostsFromOne feed = new PostsFromOne(); feed.author = name.ToString(); List <ZablevaikiResponse> USERS = UserRepository.Loshki.ToList(); ZablevaikiResponse US = USERS.Find(x => x.Login == feed.author); if (US == null) { return(View("Index")); } else { feed.Posts = PostsRepository.GetBy(feed.author); List <int> TweeIDs = new List <int> { }; foreach (var item in feed.Posts) { TweeIDs.Add(item.id); } List <TweetImg> imgs = TweetsImgsRepository.GetByMany(TweeIDs); feed.Ava = ImgsRepository.GetBy(feed.author).image; feed.TweeImgs = imgs; if (SubscribersRepository.GetSub(SecurityService.Session["UserId"].ToString(), feed.author) != null) { return(View("PersTweetSub", feed)); } else { return(View("PersTweetNonSub", feed)); } } } else { return(View("Index")); } } }
public ActionResult MyTweet() { SecurityService.Session = System.Web.HttpContext.Current.Session; SecurityService.Users = new EfModelRepository { }; if (!SecurityService.IsAuthenticated) { return(RedirectToAction("Index")); } else { PostsFromOne feed = new PostsFromOne(); feed.author = System.Web.HttpContext.Current.Session["UserId"].ToString(); feed.Posts = PostsRepository.GetBy(feed.author); return(View("MineTweet", feed)); } }