public async Task <ApplicationResponseDto> LiabilityClauseAsync(NewLiabilityClauseRequestDto dto) { var response = await _client.PostAsJsonAsync("entity/liability/clause", dto); if (response.IsSuccessStatusCode) { return(await response.Content.ReadAsAsync <ApplicationResponseDto>()); } return(null); }
// TODO: change from dto to just a string public async Task <ApplicationResponseDto> InsertLiabilityClauseAsync(Guid user, NewLiabilityClauseRequestDto dto) { var application = await GetPrivateEntityApplicationAsync(user, dto.ApplicationId); await LoadSavedMemorandumAsync(application); application.PrivateEntity.MemorandumOfAssociation ??= new MemorandumOfAssociation(); application.PrivateEntity.MemorandumOfAssociation.LiabilityClause = dto.LiabilityClause; return(await ReturnApplicationResponse(application)); }
public async Task <IActionResult> Clauses([FromBody] NewLiabilityClauseRequestDto 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(await _privateEntityService.InsertLiabilityClauseAsync(user.Sub, dto))); }