Example #1
0
 public ActionResult Register(UserRegister users)
 {
     if (ModelState.IsValid)
     {
         User u = new User
         {
             FirstName = users.FirstName,
             BirthDate = users.BirthDate,
             Email     = users.Email,
             LastName  = users.LastName,
             Password  = users.Password,
             UserName  = users.UserName
         };
         ur.AddUserToDb(u);
         mycookie["UserName"] = u.UserName;
         mycookie.Expires     = DateTime.Now.AddDays(1);
         Response.Cookies.Add(mycookie);
         return(RedirectToAction("Index", "Home"));
     }
     return(View(new UserRegister()));
 }