Пример #1
0
        public ActionResult Edit()
        {
            var userName = WebSecurity.CurrentUserName;
            //Lấy thông tin của user
            var userInfoBAL = new UserInformationBAL();

            var model = userInfoBAL.GetByUserName(userName);

            return(View(new UserInformationForEditModel()
            {
                UserName = model.UserName,
                FirstName = model.FirstName,
                LastName = model.LastName,
                UserEmail = model.UserEmail,
                CityCode = model.CityCode,
                Status = model.Status
            }));
        }
Пример #2
0
 public ActionResult IsAuthenticated()
 {
     if (WebSecurity.IsAuthenticated)
     {
         var userInfo = new SignnedInUserModel();
         userInfo.UserName   = WebSecurity.CurrentUserName;
         userInfo.IsLoggedIn = WebSecurity.IsAuthenticated;
         var userInformationBL = new UserInformationBAL();
         var currUserInfo      = userInformationBL.GetByUserName(userInfo.UserName);
         if (currUserInfo != null)
         {
             userInfo.UserEmail = currUserInfo.UserEmail;
             userInfo.FirstName = currUserInfo.FirstName;
             userInfo.LastName  = currUserInfo.LastName;
         }
         return(PartialView("_AuthenticatedPartial", userInfo));
     }
     else
     {
         return(PartialView("_AnonymousPartial"));
     }
 }