Esempio n. 1
0
        public ActionResult EditPost(user_login user_Login)
        {
            var user = db.user_login.Find(user_Login.user_id);

            user.role          = user_Login.role;
            user.status        = user_Login.status;
            user.date_modified = DateTime.Now;

            try
            {
                db.user_login.Attach(user);
                db.Entry(user).Property(x => x.role).IsModified          = true;
                db.Entry(user).Property(x => x.status).IsModified        = true;
                db.Entry(user).Property(x => x.date_modified).IsModified = true;
                db.SaveChanges();

                return(Json("0", JsonRequestBehavior.AllowGet));
            }
            catch (DataException)
            {
                return(Json("1", JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 2
0
        public ActionResult LogOut()
        {
            var user_id = Session["user_id"].ToString();

            using (HRISContext db = new HRISContext())
            {
                var updateUserLogin = db.user_login.SingleOrDefault(m => m.user_id == user_id);
                updateUserLogin.last_login = DateTime.Now;
                db.user_login.Attach(updateUserLogin);
                db.Entry(updateUserLogin).Property(x => x.last_login).IsModified = true;
                db.SaveChanges();
            }

            FormsAuthentication.SignOut();
            Session.Abandon();
            return(RedirectToAction("Index", "Home"));
        }