Пример #1
0
        public JsonResult Login(UserApp user, string password)
        {
            UserApp thisUser = UserManagerApp.Find(user.Email, password);

            if (thisUser != null)
            {
                ClaimsIdentity Ident = UserManagerApp.CreateIdentity(thisUser, DefaultAuthenticationTypes.ApplicationCookie);
                HttpContext.GetOwinContext().Authentication.SignOut();

                HttpContext.GetOwinContext().Authentication.SignIn(new AuthenticationProperties()
                {
                    IsPersistent = false
                }, Ident);
                return(Json(new { status = "ok" }));
            }
            else
            {
                return(Json(new { status = "error" }));
            }
        }
Пример #2
0
        public void TestFind()
        {
            var user = _app.Find(21);

            Console.WriteLine(user.Name);
        }
Пример #3
0
 public ActionResult Add(int id = 0)
 {
     return(View(_app.Find(id)));
 }