Ejemplo n.º 1
0
 public ActionResult Login(User user)
 {
     if (user.IsValid(user.USER_DISPLAYNAME, user.PASSWORD))
     {
         FormsAuthentication.SetAuthCookie(user.USER_DISPLAYNAME, user.RememberMe);
         return RedirectToAction("Index", "Home");
     }
     else
     {
         ModelState.AddModelError("", "Login data is incorrect!");
     }
     return View(user);
 }
Ejemplo n.º 2
0
        public User insertUser(User newUser)
        {
            User user2add = newUser;
            USER u3 = new USER();
            UserRepo userRepo = new UserRepo();

            u3.USER_FNAME = user2add.USER_FNAME;
            u3.USER_LNAME = user2add.USER_LNAME;
            u3.USER_EMAIL = user2add.EMAIL;
            u3.USER_DISPLAYNAME = user2add.USER_DISPLAYNAME;
            u3.PASSWORD = user2add.PASSWORD;
            u3.CREATED_TIMESTAMP = DateTime.Now;
            userRepo.add(u3);

            return user2add;
        }
        public ActionResult Register(User model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                {
                    IService service = new BookService();
                    service.insertUser(model);
                    return RedirectToAction("Index", "Home");

                }

            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Ejemplo n.º 4
0
        public User insertUser(User newUser)
        {
            User user2add = newUser;
            USER u3 = null;
            UserRepo userRepo = new UserRepo();
            DateTime dt = DateTime.Now;
            long a = dt.Ticks;

            u3.USER_FNAME = newUser.USER_FNAME;
            u3.USER_LNAME = newUser.USER_LNAME;
            u3.USER_EMAIL = newUser.EMAIL;
            u3.USER_DISPLAYNAME = newUser.USER_DISPLAYNAME;
            u3.PASSWORD = newUser.PASSWORD;
            u3.CREATED_TIMESTAMP = BitConverter.GetBytes(a);
            userRepo.add(u3);

            return newUser;
        }