Ejemplo n.º 1
0
        public ActionResult Create(AdminUser adminuser)
        {
            if (ModelState.IsValid)
            {
                db.AdminUsers.Add(adminuser);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(adminuser);
        }
Ejemplo n.º 2
0
 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");
 }
Ejemplo n.º 3
0
 public ActionResult Edit(AdminUser adminuser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(adminuser).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(adminuser);
 }