public ActionResult CreateUser(OhSnapDAL.Models.User user)
 {
     if (ModelState.IsValid)
     {
         OhSnapDAL.Managers.UserManager.CreateUser(user);
         ViewBag.Text    = "User created!";
         ViewBag.Warning = string.Empty;
         return(View());
     }
     ViewBag.Warning = "Couldn`t create a user!";
     ViewBag.Text    = string.Empty;
     return(View());
 }
        public ActionResult EditUser(OhSnapDAL.Models.User user)
        {
            ViewBag.Warning = string.Empty;
            ViewBag.Text    = string.Empty;

            if (ModelState.IsValid)
            {
                var activeUser = OhSnapDAL.Managers.UserManager.GetUserFromDB(User.Identity.Name);

                if (activeUser.RoleID == 2 && user.RoleID == 1)
                {
                    ViewBag.Warning = "Changes discarded";
                    return(View());
                }

                user.RoleID = user.RoleID == 0 ? 2 : user.RoleID;
                OhSnapDAL.Managers.UserManager.EditUser(user);
                ViewBag.Text = "Changes saved!";
                return(View());
            }

            ViewBag.Warning = "Changes discarded";
            return(View());
        }