예제 #1
0
 public ActionResult Login(LoginModel lm)
 {
     UserData ud = new UserData();
     ud = convert.UserModelToData(lm);
     var userId = ud.CheckLogin(ud);
     if (userId > 0)
     {
         FormsAuthentication.SetAuthCookie(userId.ToString(), false);
         return RedirectToAction("Stories");
     }
     else
     {
         return RedirectToAction("LoginPage");
     }
 }
예제 #2
0
 /// <summary>
 ///  UserData convert to   LoginModel
 /// </summary>
 /// <param name="um"></param>
 /// <returns></returns>
 public UserData UserModelToData(LoginModel um)
 {
     UserData ud = new UserData()
     {
         Password = um.Password,
         UserName = um.Login
     };
     return ud;
 }
예제 #3
0
 /// <summary>
 ///  UserData convert to   LoginModel
 /// </summary>
 /// <param name="ud"></param>
 /// <returns></returns>
 public LoginModel UserDataToModel(UserData ud)
 {
     LoginModel um = new LoginModel()
     {
         Password = ud.Password,
         Login = ud.UserName
     };
     return um;
 }