コード例 #1
0
 public ActionResult SignUp(Membership1 m)
 {
     if (ModelState.IsValid)
     {
         TaskService.insertmembers(m);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
コード例 #2
0
 public ActionResult SignUp(Membership1 model)
 {
     using (var context = new EmployeeDBEntities())
     {
         User mem = new User
         {
             UserName = model.UserName,
             Password = model.Password
         };
         context.User.Add(mem);
         context.SaveChanges();
     }
     return(RedirectToAction("Login"));
 }
コード例 #3
0
 public ActionResult Login(Membership1 model)
 {
     using (var context = new EmployeeDBEntities())
     {
         bool isValid = context.User.Any(x => x.UserName == model.UserName && x.Password == model.Password);
         if (isValid)
         {
             FormsAuthentication.SetAuthCookie(model.UserName, false);
             return(RedirectToAction("GetAllRecords", "Home"));
         }
         else
         {
             ViewBag.Error = "Incorrect username or Password";
         }
     }
     return(View());
 }
コード例 #4
0
 public void insermembers(Membership1 u)
 {
     userdb.memberships.Add(u);
     userdb.SaveChanges();
 }
コード例 #5
0
 public static void insertmembers(Membership1 m)
 {
     taskdb.insermembers(m);
 }