Exemplo n.º 1
0
        public IActionResult Delete(int id)
        {
            // users can delete their own account and admins can delete any account
            if (id != Account.Id && Account.Role != Role.Admin)
            {
                return(Unauthorized(new { message = "Unauthorized" }));
            }

            _accountService.DeleteUser(id);
            return(Ok(new { message = "Account deleted successfully" }));
        }