Esempio n. 1
0
        public async Task <IActionResult> Archiver(string Id)
        {
            var person = await _userManager.FindByIdAsync(Id);

            if (person == null)
            {
                return(BadRequest());
            }

            // Suppression de l'utilisateur
            IdentityResult IResult = await _userManager.DeleteAsync(person);

            // Gestion du retour des erreurs
            if (!IResult.Succeeded)
            {
                foreach (IdentityError IdentityError in IResult.Errors)
                {
                    ModelState.AddModelError(IdentityError.Code, IdentityError.Description);
                }

                return(BadRequest(ModelState));
            }

            return(Json(person));
        }