Ejemplo n.º 1
0
        /// <summary>
        /// Creates a role by a given name.
        /// </summary>
        /// <param name="roleName">The role to create.</param>
        /// <returns>Information about the user creation success</returns>
        public JsonResult CreateRole(string roleName)
        {
            MyJsonResult result;

            try
            {
                _accountService.CreateRole(roleName);
                result = MyJsonResult.CreateSuccess("The role " + roleName + " has been created.");
            }
            catch (Exception ex)
            {
                result = MyJsonResult.CreateError(ex);
            }

            return(Json(result));
        }