示例#1
0
        public ActionResult Index()
        {
            //Check if logged in ==> Should be caught by [Authorize] but just in case
            if (!CheckLogin())
            {
                return(RedirectToAction("Login", "Account"));
            }
            //Get the user's ID
            string uid = GetUserID();
            //Get ASP.NET User Object
            ApplicationUser currentUser = GetUser(uid);
            //Get the LPUser based on ASP.NET User's e-mail
            LPUser lpCurrentUser = GetLPUser((string)currentUser.Email);

            try
            {
                //ViewBag.TwitterName = UnitOfWork.Twitter.GetTwitterEndTime(id);
                ViewBag.TwitterName = repository.GetTwitterTag(lpCurrentUser.UserID);
                DateTime EndTime = repository.GetTwitterEndTime(lpCurrentUser.UserID);
                ViewBag.EndTime = EndTime;
                //return View(db.Writings.ToList());
                return(View(wrepo.GetAll()));
            }
            catch
            {
                // return View(db.Writings.ToList());
                return(View(wrepo.GetAll()));
            }
            //}
        }