Ejemplo n.º 1
0
        public async Task <IActionResult> DeleteRole([FromBody] RoleNameModel role)
        {
            await userRepository.ChangeRole(role.RoleName, "user");

            await roleRepository.DeleteRole(role.RoleName);

            return(Json($"Role {role.RoleName} successfully deleted"));
        }
Ejemplo n.º 2
0
        public async Task <JsonResult> AddRole([FromBody] RoleNameModel inputRole)
        {
            if (inputRole == null)
            {
                return(Json("Role name is null"));
            }
            var realRole = await roleRepository.AddRole(inputRole.RoleName);

            var outputRole = new RolesJsonResult(realRole);

            return(Json(outputRole));
        }