public async Task <AccountToAdminEditDTO> GetAccountToAdminEdit(int id, string accountWhoRequested) { var accountToEdit = await _accountRepository.GetById(id); if (accountToEdit == null) { throw new InvalidIdException(); } var whoRequested = await _accountRepository.GetByName(accountWhoRequested); if (whoRequested == null) { throw new InvalidIdException(); } await _authorizationService.AssureAdminAuthorization(accountToEdit, whoRequested); return(new AccountToAdminEditDTO() { Id = accountToEdit.Id, Name = accountToEdit.Name, Email = accountToEdit.Email, ReciveNews = accountToEdit.AccountIdentity.News }); }