public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

                //attempt to add a role to a user
                string[] s = new string [] { model.UserName };
                Roles.AddUsersToRole(s, model.Role);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */);

                    //add profile information
                    var profile = Profile.GetProfile(model.UserName);
                    profile.FirstName = model.FirstName;
                    profile.LastName = model.LastName;
                    profile.Department = (from a in db.DepartmentModel
                                         where a.ID == model.DepartmentID
                                         select a.Name).ToList()[0];
                    profile.Save();
                    //Sends you to your dashboard
                    string dashboard = model.Role.ToString();
                    if (dashboard.Equals("Sys Admin"))
                        dashboard = "Home";
                    else if (dashboard.Equals("Admin Assist"))
                        dashboard = "Application";
                    return RedirectToAction("Index", dashboard);
                }
                else
                {
                    ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }
            }

            //set up the drop down list for roles
            RolesList roleslist = new RolesList();
            ViewBag.roleslist = new SelectList(roleslist.Roles);

            ViewBag.DepartmentID = new SelectList(db.DepartmentModel, "ID", "Name");

            // If we got this far, something failed, redisplay form
            return View(model);
        }
        public ActionResult Register()
        {
            //set up the drop down list for roles
            RolesList roleslist = new RolesList();
            ViewBag.roleslist = new SelectList(roleslist.Roles);

            ViewBag.DepartmentID = new SelectList(db.DepartmentModel, "ID", "Name");

            return View();
        }