public ActionResult Register()
 {
     var model = new RegisterVModel()
     {
         Roles = GetRolesListItems()
     };
     return View(model);
 }
        public ActionResult Register(RegisterVModel model)
        {
            if (ModelState.IsValid)
            {
                if (unit.UserRepository.RegisterUser(model.UserName, model.Email, model.Password, model.RoleId))
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, true);
                    return Redirect("/");
                }
                else
                {
                    ModelState.AddModelError("", "User registration failed");
                }
            }

            model.Roles = GetRolesListItems();
            return View(model);
        }