TweetHarbor.Controllers.AccountController.Index C# (CSharp) Method

Index() private method

private Index ( ) : System.Web.Mvc.ActionResult
return System.Web.Mvc.ActionResult
        public ActionResult Index()
        {
            if (null != HttpContext)
            {
                if (!string.IsNullOrEmpty(Request["error"]) && Request["error"] == "ImportNotAuthorized")
                {
                    ViewBag.import_error = "Unable to sign in with those credentials";
                }
                ViewBag.UserName = HttpContext.User.Identity.Name;
                var u = database.Users.Include("Projects")
                    .Include("Projects.MessageRecipients")
                    .Include("Projects.TextMessageRecipients")
                    .Include("Projects.ProjectNotifications")
                    .Include("Projects.ProjectNotifications.Build")
                    .Include("Projects.ProjectNotifications.Build.commit")
                    .Include("AuthenticationAccounts")
                    .FirstOrDefault(usr => usr.UserName == HttpContext.User.Identity.Name);

                if (null != u)
                {
                    if (string.IsNullOrEmpty(u.UniqueId))
                    {
                        //TODO: Make this much more secure
                        u.UpdateUniqueId();
                        database.SaveChanges();
                    }
                    return View(u);
                }
                else
                {
                    return RedirectToAction("LogIn");
                }
            }
            return new EmptyResult();
        }