public ActionResult DeleteConfirmed(int id) { LogInHistory loginhistory = db.LogInHistories.Find(id); db.LogInHistories.Remove(loginhistory); db.SaveChanges(); return(RedirectToAction("Index")); }
public void AddFailedLogInHistory(string userName) { LogInHistory log = new LogInHistory(); log.UserName = userName; log.LogInWhen = DateTime.Now; log.CanLogIn = false; context.Add(log); context.SaveChanges(); }
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(); }
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)); }
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)); }
// 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)); }
// 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)); }
// 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)); }