public ActionResult ConfigureUserAsManager(string username)
        {
            // The username value could be null, so test for this
            if (string.IsNullOrEmpty(username)) { return HttpNotFound(); }

            // It's possible that the user could alredy be a manager
            if (m.IsUserAManager(username)) { return RedirectToAction("nonmanagers"); }

            // If we're here, attempt to fetch the user
            var user = m.GetUserByUserName(username);

            if (user == null)
            {
                return HttpNotFound();
            }
            else
            {
                // Create an edit form
                var editForm = new ApplicationUserEditForm();

                // Set the properties
                editForm.Id = user.Id;
                editForm.FullName = string.Format("{0}, {1}", user.LastName, user.FirstName);
                editForm.UserName = user.UserName;

                // Show the form
                return View(editForm);
            }
        }
Esempio n. 2
0
        public ActionResult ConfigureUserAsManager(string username)
        {
            // The username value could be null, so test for this
            if (string.IsNullOrEmpty(username))
            {
                return(HttpNotFound());
            }

            // It's possible that the user could alredy be a manager
            if (m.IsUserAManager(username))
            {
                return(RedirectToAction("nonmanagers"));
            }

            // If we're here, attempt to fetch the user
            var user = m.GetUserByUserName(username);

            if (user == null)
            {
                return(HttpNotFound());
            }
            else
            {
                // Create an edit form
                var editForm = new ApplicationUserEditForm();

                // Set the properties
                editForm.Id       = user.Id;
                editForm.FullName = string.Format("{0}, {1}", user.LastName, user.FirstName);
                editForm.UserName = user.UserName;

                // Show the form
                return(View(editForm));
            }
        }