예제 #1
0
 public ActionResult Signup(Admin model)
 {
     using (var context = new World2MationEntities())
     {
         context.Admin.Add(model);
         context.SaveChanges();
     }
     return(RedirectToAction("Login"));
 }
예제 #2
0
 public ActionResult Login(AdminPortal models)
 {
     using (var context = new World2MationEntities())
     {
         bool isValid = context.Admin.Any(x => x.Name == models.Name && x.Password == models.Password);
         if (isValid)
         {
             FormsAuthentication.SetAuthCookie(models.Name, false);
             return(RedirectToAction("Index", "Users"));
         }
         ModelState.AddModelError("", "Invalid Username or Password");
         return(View());
     }
 }