public async Task <ApplicationResponseDto> InsertSecretary(Guid user, NewSecretaryRequestDto dto) { var application = await GetPrivateEntityApplicationAsync(user, dto.ApplicationId); application.PrivateEntity.Secretary = _mapper.Map <Secretary>(dto.Secretary); return(await ReturnApplicationResponse(application)); }
public async Task <IActionResult> Secretary(NewSecretaryRequestDto dto) { if (await _privateEntityApiClientService.NewSecretaryAsync(dto) != null) { return(Ok()); } return(BadRequest("Something went wrong in saving Directors")); }
public async Task <ApplicationResponseDto> NewSecretaryAsync(NewSecretaryRequestDto dto) { var response = await _client.PostAsJsonAsync("entity/secretary", dto); if (response.IsSuccessStatusCode) { return(await response.Content.ReadAsAsync <ApplicationResponseDto>()); } return(null); }
public async Task <IActionResult> Secretary([FromBody] NewSecretaryRequestDto dto) { User user; using (var client = new HttpClient()) { var accessToken = await HttpContext.GetTokenAsync("access_token"); client.SetBearerToken(accessToken); var response = await client.GetAsync("https://localhost:5001/connect/userinfo"); if (response.IsSuccessStatusCode) { user = await response.Content.ReadAsAsync <User>(); } else { return(Unauthorized()); } } return(Ok(_privateEntityService.InsertSecretary(user.Sub, dto))); }