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")); }
// GET: User/Index public ActionResult Index() { ViewBag.userCount = UserRepositary.getUserCount(); ViewBag.Roles = new SelectList(UserRepositary.GetRoles(), "RoleID", "RoleName"); return(View()); }