public IActionResult Register(User model)
        {
            if (ModelState.IsValid)
            {
                User CurrentUser = new User()
                {
                    FirstName   = model.FirstName,
                    LastName    = model.LastName,
                    Password    = model.Password,
                    Email       = model.Email,
                    ConPassword = model.ConPassword,
                };
                _context.Add(CurrentUser);
                _context.SaveChanges();
                HttpContext.Session.SetObjectAsJson("cur_user", CurrentUser);
                return(RedirectToAction("Dashboard"));
            }
            else
            {
                string messages = string.Join("; ", ModelState.Values
                                              .SelectMany(x => x.Errors)
                                              .Select(x => x.ErrorMessage));
                Console.WriteLine(messages);
                HttpContext.Session.SetObjectAsJson("reg_errors", ModelState.Values);
                return(RedirectToAction("Index"));
            }

            //List<Dictionary<string, object>> Allq = _dbConnector.Query("SELECT * FROM quotes ORDER BY created_at Desc");
        }
Ejemplo n.º 2
0
        public IActionResult Create(string wedderone, string weddertwo, string address, DateTime date)
        {
            Wedding wedding = new Wedding()
            {
                name    = $"{wedderone} + {weddertwo}",
                address = address,
                date    = date
            };

            _context.Add(wedding);
            _context.SaveChanges();
            List <User> users = _context.Users.ToList();
            Wedding     added = _context.Weddings.Where(id => id.name == wedding.name).SingleOrDefault();

            foreach (User user in users)
            {
                Schedule schedule = new Schedule()
                {
                    userid    = user.id,
                    weddingid = added.id,
                    status    = "Not attending"
                };
                _context.Add(schedule);
            }
            _context.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
Ejemplo n.º 3
0
 public IActionResult Register(RegisterViewModel model)
 {
     if (ModelState.IsValid)
     {
         User CheckUser = _context.Users.SingleOrDefault(u => u.Email == model.Email);
         Console.WriteLine(CheckUser);
         if (CheckUser != null)
         {
             TempData["EmailInUseError"] = "Email Aleady in use";
             return(RedirectToAction("Index"));
         }
         User newUser = new User
         {
             Username   = model.Username,
             Email      = model.Email,
             Wins       = 0,
             Losses     = 0,
             Created_At = DateTime.Now,
             Updated_At = DateTime.Now
         };
         PasswordHasher <User> hasher = new PasswordHasher <User>();
         newUser.Password = hasher.HashPassword(newUser, model.Password);
         _context.Add(newUser);
         _context.SaveChanges();
         HttpContext.Session.SetInt32("currentUserId", newUser.UserId);
         HttpContext.Session.SetString("currentFirstName", newUser.Username);
         return(RedirectToAction("Dashboard"));
     }
     else
     {
         return(View("Index"));
     }
 }
Ejemplo n.º 4
0
        public IActionResult RegisterProcess(User user)
        {
            if (ModelState.IsValid)
            {
                var dbuser = dbContext.UserTable.FirstOrDefault(u => u.Email == user.Email);
                if (dbContext.UserTable.Any(u => u.Email == user.Email))
                {
                    ModelState.AddModelError("Email", "Email already in use!");
                    return(View("RegisterView"));
                }
                // password hasher
                PasswordHasher <User> Hasher = new PasswordHasher <User>();
                user.Password = Hasher.HashPassword(user, user.Password);
                // saving in db

                dbContext.Add(user);
                dbContext.SaveChanges();
                // setting stuff in session
                HttpContext.Session.SetInt32("UserID", user.UserId);
                //
                HttpContext.Session.SetString("Firstname", user.FirstName);
                HttpContext.Session.SetString("Lastname", user.LastName);

                return(RedirectToAction("Dashboard"));
            }
            return(View("RegisterView"));
        }
Ejemplo n.º 5
0
 public IActionResult Register(UserViewModel UserInput)
 {
     if (ModelState.IsValid)
     {
         List <User> CheckEmail = _context.users.Where(user => user.Email == UserInput.Email).ToList();
         if (CheckEmail.Count == 0)
         {
             PasswordHasher <UserViewModel> Hasher = new PasswordHasher <UserViewModel>();
             UserInput.Password = Hasher.HashPassword(UserInput, UserInput.Password);
             User NewUser = new User
             {
                 FirstName = UserInput.FirstName,
                 LastName  = UserInput.LastName,
                 Email     = UserInput.Email,
                 Password  = UserInput.Password
             };
             _context.Add(NewUser);
             _context.SaveChanges();
             User SaveUser = _context.users.SingleOrDefault(user => user.Email == NewUser.Email);
             HttpContext.Session.SetInt32("CurId", NewUser.UserId);
             HttpContext.Session.SetString("CurUser", NewUser.FirstName);
             HttpContext.Session.SetString("CurEmail", NewUser.Email);
             return(RedirectToAction("Dashboard"));
         }
         ViewBag.error = "Email already exisits in database";
         return(View("LoginPage"));
     }
     return(View("LoginPage", UserInput));
 }
        public IActionResult Register(RegisterViewModel model)
        {
            List <User> UserMatch = _context.users.Where(user => user.email == model.email).ToList();

            if (UserMatch.Count != 0)
            {
                ViewBag.existing = "This email is already registered. Please log in or use a different email.";
                Console.WriteLine(ViewBag.existing);
                return(View("Index"));
            }

            if (ModelState.IsValid)
            {
                User NewUser = new User
                {
                    first    = model.first,
                    last     = model.last,
                    email    = model.email,
                    password = model.password
                };
                _context.Add(NewUser);
                _context.SaveChanges();
                return(RedirectToAction("Index"));
            }
            @ViewBag.errors = ModelState.Values;
            return(View("Index"));
        }
Ejemplo n.º 7
0
        public IActionResult register(IndexViewModel user)
        {
            User regUser = user.NewRegUser;

            // Check initial ModelState
            if (ModelState.IsValid)
            {
                // If a User exists with provided email
                if (dbContext.Users.Any(u => u.Email == regUser.Email))
                {
                    ModelState.AddModelError("NewRegUser.Email", "Email already registered!");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    PasswordHasher <User> Hasher = new PasswordHasher <User>();
                    regUser.Password = Hasher.HashPassword(regUser, regUser.Password);
                    // Add the user to database here
                    dbContext.Add(regUser);
                    dbContext.SaveChanges();
                    HttpContext.Session.SetString("UserEmail", regUser.Email);

                    return(RedirectToAction("Dashboard"));
                }
            }
            else
            {
                return(View("Index"));
            }
        }
 public IActionResult Add(Wedding Wed)
 {
     if (Wed.date < DateTime.Now.Date)
     {
         TempData["message"] = "Date cant be in the past";
         System.Console.WriteLine("Date cant be in the past");
         System.Console.WriteLine("Date cant be in the past");
         System.Console.WriteLine("Date cant be in the past");
         System.Console.WriteLine("Date cant be in the past");
         System.Console.WriteLine("Date cant be in the past");
         return(RedirectToAction("AddPage"));
     }
     if (ModelState.IsValid)
     {
         Wed.created_at = DateTime.Now;
         Wed.updated_at = DateTime.Now;
         Wed.userId     = (int)HttpContext.Session.GetInt32("UserId");
         _context.Add(Wed);
         _context.SaveChanges();
         TempData["message"] = "Sucessfully added a new wedding";
     }
     else
     {
         TempData["message"] = "Unsucessful in adding a new wedding";
     }
     return(RedirectToAction("Wedding"));
 }
Ejemplo n.º 9
0
        public IActionResult Create(Wedding wedding)
        {
            int?UserID = HttpContext.Session.GetInt32("LogedUserID");

            if (UserID != null)
            {
                Person dbUser = _context.Users.SingleOrDefault(u => u.UserID == UserID);

                if (ModelState.IsValid)
                {
                    wedding.User = dbUser;
                    dbUser.Wedding.Add(wedding);
                    _context.Add(wedding);
                    _context.SaveChanges();
                    return(RedirectToAction("Weddings", "Home"));
                }
                else
                {
                    return(View("AddNewWedding"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Ejemplo n.º 10
0
        public IActionResult Register(RegisterViewModel user)
        {
            if (ModelState.IsValid)
            {
                var userList = _context.users.Where(p => p.email == user.email).ToList();
                foreach (var item in userList)
                {
                    if (user.email == item.email)
                    {
                        ModelState.AddModelError("email", "email exists");
                        return(View("index"));
                    }
                }

                PasswordHasher <RegisterViewModel> Hasher = new PasswordHasher <RegisterViewModel>();
                user.password = Hasher.HashPassword(user, user.password);
                users User = new users()
                {
                    first_name = user.first_name,
                    last_name  = user.last_name,
                    email      = user.email,
                    password   = user.password,
                    created_at = DateTime.Now,
                    updated_at = DateTime.Now
                };
                _context.Add(User);
                _context.SaveChanges();
                HttpContext.Session.SetInt32("Id", (int)User.id);
                return(RedirectToAction("Wedding"));
            }
            else
            {
                return(View("index"));
            }
        }
Ejemplo n.º 11
0
        public IActionResult Register(User user, string PasswordConfirm)
        {
            if (user.Password != PasswordConfirm)
            {
                ViewBag.PasswordError = "Passwords don't match";
                return(View("Index"));
            }
            if (ModelState.IsValid)
            {
                PasswordHasher <User> Hasher = new PasswordHasher <User>();
                user.Password = Hasher.HashPassword(user, user.Password);
                User ExistingEmail = _context.users.SingleOrDefault(u => u.Email == user.Email);

                if (ExistingEmail != null)
                {
                    ViewBag.RegError = "Email already registered";
                    return(View("Index"));
                }
                else
                {
                    _context.Add(user);
                    _context.SaveChanges();

                    int?UserId = user.UserId;
                    HttpContext.Session.SetInt32("UserId", (int)UserId);
                    return(RedirectToAction("Dashboard"));
                }
            }
            else
            {
                return(View("Index"));
            }
        }
        public IActionResult Register(Users user)
        {
            // Check initial ModelState
            if (ModelState.IsValid)
            {
                // If a User exists with provided email
                if (dbContext.Users.Any(u => u.Email == user.Email))
                {
                    // Manually add a ModelState error to the Email field, with provided
                    // error message
                    ModelState.AddModelError("Email", "Email already in use!");

                    return(View("Index"));
                    // You may consider returning to the View at this point
                }

                // Initializing a PasswordHasher object, providing our User class as its
                PasswordHasher <Users> Hasher = new PasswordHasher <Users>();
                user.Password = Hasher.HashPassword(user, user.Password);
                //Save your user object to the database
                dbContext.Add(user);
                dbContext.SaveChanges();

                HttpContext.Session.SetInt32("id", user.UserId);
                Console.WriteLine(HttpContext.Session.GetInt32("id"));
                return(RedirectToAction("Success"));
            }
            // other code
            return(View("Index"));
        }
Ejemplo n.º 13
0
 public IActionResult RegisterUser(User newUser)
 {
     if (ModelState.IsValid)
     {
         if (DbContext.Users.Any(u => u.Email == newUser.Email))
         {
             ModelState.AddModelError("Email", "Email is already in use! Please log in or use a different email address.");
             return(View("Index"));
         }
         else
         {
             PasswordHasher <User> Hasher = new PasswordHasher <User>();
             newUser.Password = Hasher.HashPassword(newUser, newUser.Password);
             DbContext.Add(newUser);
             DbContext.SaveChanges();
             HttpContext.Session.SetString("User", newUser.FirstName);
             HttpContext.Session.SetInt32("UserId", newUser.UserId);
             System.Console.WriteLine("************* Session User:"******"***************");
             return(RedirectToAction("Dashboard"));
         }
     }
     else
     {
         return(View("Index"));
     }
 }
Ejemplo n.º 14
0
 public IActionResult CreateWedding(Wedding newWedding)
 {
     newWedding.UserId = (int)HttpContext.Session.GetInt32("curUser");
     if (ModelState.IsValid)
     {
         dbContext.Add(newWedding);
         dbContext.SaveChanges();
         return(RedirectToAction("Dashboard"));
     }
     return(View("Plan"));
 }
 public IActionResult Add(Wedding NewWedding)
 {
     if (ModelState.IsValid)
     {
         _context.Add(NewWedding);
         int?userid = HttpContext.Session.GetInt32("userid");
         NewWedding.UserId = (int)userid;
         _context.SaveChanges();
         return(Redirect($"/wedding/{NewWedding.WeddingId}"));
     }
     return(View("Plan"));
 }
Ejemplo n.º 16
0
        public IActionResult NewProcess(Wedding wed)
        {
            wed.UserId = (int)HttpContext.Session.GetInt32("id");
            if (ModelState.IsValid)
            {
                dbContext.Add(wed);
                dbContext.SaveChanges();
                return(RedirectToAction("DisplayWed", new{ wedId = wed.WeddingId }));
            }

            return(View("WeddingNew"));
        }
        public IActionResult Wedform(Wedding NewWedding)
        {
            System.Console.WriteLine("adding newwedding");

            int?loggedUserId = HttpContext.Session.GetInt32("UserId");


            NewWedding.UserId = (int)loggedUserId;

            _context.Add(NewWedding);
            _context.SaveChanges();

            return(RedirectToAction("show"));
        }
Ejemplo n.º 18
0
 public IActionResult RSVP(int wedding_id)
 {
     if (_loggedinuser != null)
     {
         Join join = new Join()
         {
             wedding_id = wedding_id,
             joiner_id  = _loggedinuser.user_id
         };
         _wcontext.Add(join);
         _wcontext.SaveChanges();
         return(RedirectToAction("Dashboard", new{ id = _loggedinuser.user_id }));
     }
     return(RedirectToAction("Home", "LogReg"));
 }
Ejemplo n.º 19
0
 public IActionResult Register(RegisterViewModel model)
 {
     if (ModelState.IsValid)
     {
         User CheckExist = _context.Users.SingleOrDefault(user => user.Email == model.Email);
         if (CheckExist == null)
         {
             User newUser = new User
             {
                 FirstName = model.FirstName,
                 LastName  = model.LastName,
                 Email     = model.Email,
                 Password  = model.Password,
                 Balance   = 0,
             };
             PasswordHasher <User> Hasher = new PasswordHasher <User>();
             newUser.Password = Hasher.HashPassword(newUser, newUser.Password);
             _context.Add(newUser);
             _context.SaveChanges();
             HttpContext.Session.SetInt32("userid", newUser.UserId);
             return(RedirectToAction("Dashboard", "Wedding"));
         }
         else
         {
             TempData["email_exists"] = "That email has already been registered";
         }
     }
     return(View("Index"));
 }
Ejemplo n.º 20
0
        public IActionResult Register(RegisterUser regUser)
        {
            // Check uniqueness of user's email
            if (_context.users.Where(user => user.email == regUser.email).ToList().Count() > 0)
            {
                ModelState.AddModelError("email", "Email already exists");
            }

            if (ModelState.IsValid)
            {
                PasswordHasher <RegisterUser> hasher = new PasswordHasher <RegisterUser>();

                User NewPerson = new User
                {
                    first_name = regUser.first_name,
                    last_name  = regUser.last_name,
                    email      = regUser.email,
                    password   = hasher.HashPassword(regUser, regUser.password)
                };

                _context.Add(NewPerson);
                // or _context.User.Add(NewPerson);
                _context.SaveChanges();
                int UserId = _context.users.Last().userId;

                // Console.WriteLine("User Id: " + UserId);
                HttpContext.Session.SetInt32("UserId", UserId);

                return(RedirectToAction("Index", "Wedding"));
            }
            return(View("Index"));
        }
 public IActionResult Register(RegisterViewModel model)
 {
     if (ModelState.IsValid)
     {
         User ExistingUser = _context.Users.SingleOrDefault(user => user.Email == model.Email);
         if (ExistingUser != null)
         {
             ViewBag.Message = "User with this email already exists!";
             return(View("Index", model));
         }
         User NewUser = new User
         {
             FirstName = model.FirstName,
             LastName  = model.LastName,
             Email     = model.Email,
             Password  = model.Password,
             CreatedAt = DateTime.UtcNow,
             UpdatedAt = DateTime.UtcNow
         };
         _context.Add(NewUser);
         _context.SaveChanges();
         NewUser = _context.Users.SingleOrDefault(user => user.Email == NewUser.Email);
         HttpContext.Session.SetInt32("UserId", NewUser.UserId);
         return(RedirectToAction("Index", "Dashboard"));
     }
     else
     {
         return(View("Index", model));
     }
 }
Ejemplo n.º 22
0
        public IActionResult RegisterUser(RegisterUser newUser)
        {
            if (_context.Users.Where(user => user.Email == newUser.Email).SingleOrDefault() != null)
            {
                ModelState.AddModelError("Email", "Email already in use");
            }
            PasswordHasher <RegisterUser> hasher = new PasswordHasher <RegisterUser>();

            if (ModelState.IsValid)
            {
                User theUser = new User
                {
                    FirstName = newUser.FirstName,
                    LastName  = newUser.LastName,
                    Email     = newUser.Email,
                    Password  = hasher.HashPassword(newUser, newUser.Password),
                    CreatedAt = DateTime.Now,
                    UpdatedAt = DateTime.Now,
                };
                User loggedUser = _context.Add(theUser).Entity;
                _context.SaveChanges();
                HttpContext.Session.SetInt32("id", loggedUser.UserId);
                return(RedirectToAction("Index", "Wedding"));
            }
            ;
            return(View("Index"));
        }
Ejemplo n.º 23
0
 public IActionResult DoesRegister(UserObject user)
 {
     System.Console.WriteLine("****************Does Register");
     // Check initial ModelState
     if (ModelState.IsValid)
     {
         // If a User exists with provided email
         if (dbContext.Users.Any(u => u.Email == user.Email))
         {
             System.Console.WriteLine("****************Email in use");
             // Manually add a ModelState error to the Email field, with provided error message
             ModelState.AddModelError("Email", "Email already in use!");
             // You may consider returning to the View at this point
             return(View("Index"));
         }
         else
         {
             System.Console.WriteLine("****************Creating User");
             // Initializing a PasswordHasher object, providing our User class as its
             PasswordHasher <UserObject> Hasher = new PasswordHasher <UserObject>();
             user.Password = Hasher.HashPassword(user, user.Password);
             //Save your user object to the database
             dbContext.Add(user);
             dbContext.SaveChanges();
             HttpContext.Session.SetInt32("userid", user.UserId);
             return(Redirect("/success")); //This doesn't exist yet
         }
     }
     // other code
     else
     {
         System.Console.WriteLine("****************User Not Created");
         return(View("Index"));
     }
 }
Ejemplo n.º 24
0
 public IActionResult Create(Wedding newWedding)
 {
     if (ModelState.IsValid)
     {
         //Save your user object to the database
         newWedding.UserId = (int)HttpContext.Session.GetInt32("userid");
         dbContext.Add(newWedding);
         dbContext.SaveChanges();
         return(Redirect("/dashboard")); //This doesn't exist yet
     }
     // other code
     else
     {
         return(View("New"));
     }
 }
Ejemplo n.º 25
0
        public IActionResult RegisterUser(RegisterUser newuser)
        {
            User CheckEmail = _wContext.users
                              .Where(u => u.email == newuser.email)
                              .SingleOrDefault();

            if (CheckEmail != null)
            {
                ViewBag.errors = "That email already exists";
                return(RedirectToAction("Register", "Home"));
            }
            if (ModelState.IsValid)
            {
                PasswordHasher <RegisterUser> Hasher = new PasswordHasher <RegisterUser>();
                User newUser = new User
                {
                    user_id    = newuser.user_id,
                    first_name = newuser.first_name,
                    last_name  = newuser.last_name,
                    email      = newuser.email,
                    password   = Hasher.HashPassword(newuser, newuser.password)
                };
                _wContext.Add(newUser);
                _wContext.SaveChanges();
                ViewBag.success = "Successfully registered";
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                return(View("Register", "Home"));
            }
        }
Ejemplo n.º 26
0
 public IActionResult Register(RegisterViewModel model)
 {
     if (_context.users.Where(u => u.email == model.email).SingleOrDefault() != null)
     {
         TempData["message"] = "Email is taken!";
         return(RedirectToAction("Index"));
     }
     else
     {
         if (ModelState.IsValid)
         {
             User NewUser = new User {
                 first_name = model.first_name,
                 last_name  = model.last_name,
                 email      = model.email,
                 password   = model.password
             };
             _context.Add(NewUser);
             _context.SaveChanges();
             User current = _context.users.Where(u => u.email == model.email).SingleOrDefault();
             HttpContext.Session.SetInt32("UserId", current.id);
             TempData["message"] = "You have successfully registered!";
             return(RedirectToAction("Wedding", "Wedding"));
         }
         ViewBag.Errors = ModelState.Values;
         ViewBag.Status = true;
         return(View("Index"));
     }
 }
Ejemplo n.º 27
0
        public IActionResult Register(UserViewModel RegUser)
        {
            if (!ModelState.IsValid)
            {
                return(View("Index"));
            }
            else
            {
                User UserCheck = _context.Users.SingleOrDefault(user => user.Email == RegUser.RegisterUser.Email);
                if (UserCheck != null)
                {
                    ViewBag.EmailExists = "That user already exists!";
                    return(View("Index"));
                }
                else
                {
                    PasswordHasher <Register> hasher = new PasswordHasher <Register>();
                    string HashedPW = hasher.HashPassword(RegUser.RegisterUser, RegUser.RegisterUser.Password);
                    User   NewUser  = new User
                    {
                        FirstName = RegUser.RegisterUser.FirstName,
                        LastName  = RegUser.RegisterUser.LastName,
                        Email     = RegUser.RegisterUser.Email,
                        Password  = HashedPW,
                    };
                    _context.Add(NewUser);
                    _context.SaveChanges();

                    User LoggedIn = _context.Users.SingleOrDefault(user => user.Email == RegUser.RegisterUser.Email);
                    HttpContext.Session.SetInt32("UserId", LoggedIn.UserId);
                    HttpContext.Session.SetString("UserName", LoggedIn.FirstName);
                    return(RedirectToAction("ShowDash"));
                }
            }
        }
Ejemplo n.º 28
0
        public IActionResult Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                User NewUser = new User
                {
                    FirstName = model.FirstName,
                    LastName  = model.LastName,
                    EmailId   = model.EmailId,
                    Password  = model.Password,
                };

                // Handle success

                System.Console.WriteLine("Came here");
                _context.Add(NewUser);
                _context.SaveChanges();
                System.Console.WriteLine("Done adding to DB");
                User EnteredPerson = _context.user.SingleOrDefault(user => user.EmailId == model.EmailId);
                HttpContext.Session.SetString("FirstName", EnteredPerson.FirstName);
                HttpContext.Session.SetInt32("UserId", EnteredPerson.UserId);
                return(RedirectToAction("show", "Wedding"));
            }
            else
            {
                ViewBag.errors = ModelState.Values;
                ViewBag.Errors = new List <string>();
                return(View("Index"));
            }
        }
 public IActionResult register(RegisterViewModel testUser)
 {
     if (ModelState.IsValid)
     {
         User currentUser = _context.Users.SingleOrDefault(user => user.Email == testUser.Email);
         if (currentUser != null)
         {
             ModelState.AddModelError("Email", "There is already a registered user with that email.");
             return(View("Reg", testUser));
         }
         User NewUser = new User
         {
             FirstName = testUser.FirstName,
             LastName  = testUser.LastName,
             Email     = testUser.Email,
             Password  = testUser.Password
         };
         _context.Add(NewUser);
         _context.SaveChanges();
         currentUser = _context.Users.SingleOrDefault(user => user.Email == NewUser.Email);
         HttpContext.Session.SetInt32("currentUser", (int)currentUser.UserId);
         return(Redirect("/dashboard"));
     }
     else
     {
         return(View("Reg", testUser));
     }
 }
Ejemplo n.º 30
0
        public IActionResult Register(LoginAndReg Register)

        {
            if (TryValidateModel("regmodel"))
            {
                if (dbContext.Users.Any(u => u.Email == Register.regmodel.Email))
                {
                    ModelState.AddModelError("Email", "Email already in use!");
                    return(View("index", Register));
                }
                PasswordHasher <User> hasher = new PasswordHasher <User>();
                User newUser = new User
                {
                    FirstName = Register.regmodel.FirstName,
                    LastName  = Register.regmodel.LastName,
                    Email     = Register.regmodel.Email,
                    Password  = hasher.HashPassword(Register.regmodel, Register.regmodel.Password)
                };
                dbContext.Add(newUser);
                dbContext.SaveChanges();
                HttpContext.Session.SetInt32("CurrentUser", Register.regmodel.UserId);
                return(RedirectToAction("DashboardView", "Wedding"));
            }
            return(View("Index", Register));
        }