示例#1
0
 public ActionResult Register([Bind(Include = "UserID,Name,UserName,MailID,Password,RoleID")] User user)
 {
     if (!ModelState.IsValid)
     {
         return(View("Index", user));
     }
     UserRepositary.Add(user);
     ViewBag.Message = "Registration Successfull";
     ViewBag.Roles   = new SelectList(UserRepositary.GetRoles(), "RoleID", "RoleName");
     return(RedirectToAction("Index"));
 }
示例#2
0
 // GET: User/Index
 public ActionResult Index()
 {
     ViewBag.userCount = UserRepositary.getUserCount();
     ViewBag.Roles     = new SelectList(UserRepositary.GetRoles(), "RoleID", "RoleName");
     return(View());
 }