Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            LogInHistory loginhistory = db.LogInHistories.Find(id);

            db.LogInHistories.Remove(loginhistory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
        public void AddFailedLogInHistory(string userName)
        {
            LogInHistory log = new LogInHistory();

            log.UserName  = userName;
            log.LogInWhen = DateTime.Now;
            log.CanLogIn  = false;
            context.Add(log);
            context.SaveChanges();
        }
Пример #3
0
        public void AddFailedLogInHistory(string userName)
        {
            LogInHistory log = new LogInHistory();

            log.UserName  = userName;
            log.LogInWhen = DateTime.Now;
            log.CanLogIn  = false;
            ctx.LogInHistories.InsertOnSubmit(log);
            ctx.SubmitChanges();
        }
Пример #4
0
 public ActionResult Edit([Bind(Include = "id,UserId,DateTime,Ip")] LogInHistory loginhistory)
 {
     loginhistory.DateTime = DateTime.Now;
     loginhistory.Ip       = Request.UserHostAddress;
     if (ModelState.IsValid)
     {
         db.Entry(loginhistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId = new SelectList(db.Userses, "Id", "Name", loginhistory.UserId);
     return(View(loginhistory));
 }
Пример #5
0
        public ActionResult Create(LogInHistory loginhistory)
        {
            loginhistory.DateTime = DateTime.Now;
            loginhistory.Ip       = Request.UserHostAddress;
            if (ModelState.IsValid)
            {
                db.LogInHistories.Add(loginhistory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.UserId = new SelectList(db.Userses, "Id", "Name", loginhistory.UserId);
            return(View(loginhistory));
        }
Пример #6
0
        // GET: /LogInHistory/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LogInHistory loginhistory = db.LogInHistories.Find(id);

            if (loginhistory == null)
            {
                return(HttpNotFound());
            }
            return(View(loginhistory));
        }
Пример #7
0
        // GET: /LogInHistory/Delete/5
        public ActionResult Delete(int?id)
        {
            if (Session["type"] == null || Session["type"] == "")
            {
                Session["dv"] = "Delete";
                Session["dc"] = "LogInHistory";
                return(RedirectToAction("Login", "Users"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LogInHistory loginhistory = db.LogInHistories.Find(id);

            if (loginhistory == null)
            {
                return(HttpNotFound());
            }
            return(View(loginhistory));
        }
Пример #8
0
        // GET: /LogInHistory/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Session["type"] == null || Session["type"] == "")
            {
                Session["dv"] = "Edit";
                Session["dc"] = "LogInHistory";
                return(RedirectToAction("Login", "Users"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LogInHistory loginhistory = db.LogInHistories.Find(id);

            if (loginhistory == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserId = new SelectList(db.Userses, "Id", "Name", loginhistory.UserId);
            return(View(loginhistory));
        }