示例#1
0
        public async Task <ActionResult <ApplicationUserEditDto> > DeleteUser(string id)
        {
            try
            {
                if (User.GetSubjectId() == id)
                {
                    throw new ValidationException("Cannot delete yourself.");
                }

                await _service.DeleteUserAsync(id);

                return(NoContent());
            }
            catch (NotFoundException e)
            {
                return(NotFound(e.Message));
            }
            catch (ValidationException e)
            {
                return(BadRequest(e.Message));
            }
        }