public ActionResult Info(int id, int? page = 1) { var currentUser = (UserViewModel)HttpContext.Session["CurrentUser"]; var curUser = userService.GetById(id); if (id == currentUser.Id) return RedirectToAction("UserPage"); var infoModel = new InfoViewModel(); infoModel.CurrentUserFollows = followService.GetList(); infoModel.Users = userService.GetAll(currentUser.Id); UserViewModel thisUser = userService.GetById(id); var tweets = tweetService.GetListById(thisUser.Id); infoModel.User = curUser; infoModel.TweetsCount = tweets.Count; int pageSize = 25; int pageNumber = (page ?? 1); int totalItems = tweets.Count; infoModel.Tweets = tweets.ToPagedList(pageNumber, pageSize); Logger.Log.Debug("information about user ID:" + curUser.Id + " " + curUser.Email + " are displayed"); return View(infoModel); }
public ActionResult UserPage(int? page = 1) { var infoModel = new InfoViewModel(); var currentUser = (UserViewModel)HttpContext.Session["CurrentUser"]; var curUser = userService.GetById(currentUser.Id); infoModel.CurrentUserFollows = followService.GetList(); var tweets = tweetService.GetListById(currentUser.Id); infoModel.TweetsCount = tweets.Count; infoModel.User = curUser; int pageSize = 25; int pageNumber = (page ?? 1); int totalItems = tweets.Count; infoModel.Tweets = tweets.ToPagedList(pageNumber, pageSize); Logger.Log.Debug("user " + currentUser.Id + " " + currentUser.Email + " entered on his userpage"); return View(infoModel); }