public ActionResult Create(AdminUser adminuser) { if (ModelState.IsValid) { db.AdminUsers.Add(adminuser); db.SaveChanges(); return RedirectToAction("Index"); } return View(adminuser); }
public ActionResult Index(AdminUser adminuser, string ReturnUrl = "") { var user = db.AdminUsers.Where(au => au.AdminUsername == adminuser.AdminUsername && au.AdminPassword == adminuser.AdminPassword).SingleOrDefault(); if (user == null) { ModelState.AddModelError("", "Login data is incorrect"); return View(user); } FormsAuthentication.SetAuthCookie(user.AdminUsername, false); Session["AdminUser"] = user; //return Redirect(ReturnUrl); if (Url.IsLocalUrl(ReturnUrl)) return Redirect(ReturnUrl); else return RedirectToAction("Index", "Admin/Banner"); }
public ActionResult Edit(AdminUser adminuser) { if (ModelState.IsValid) { db.Entry(adminuser).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(adminuser); }