public async Task <ApplicationResponseDto> InsertArticlesOfAssociationAsync(Guid user, NewArticleOfAssociationRequestDto dto) { var application = await GetPrivateEntityApplicationAsync(user, dto.ApplicationId); application.PrivateEntity.ArticlesOfAssociation = _mapper.Map <NewArticleOfAssociationRequestDto, ArticlesOfAssociation>(dto); return(await ReturnApplicationResponse(application)); }
public async Task <ApplicationResponseDto> TableOfArticlesAsync(NewArticleOfAssociationRequestDto dto) { var response = await _client.PostAsJsonAsync("entity/articles", dto); if (response.IsSuccessStatusCode) { return(await response.Content.ReadAsAsync <ApplicationResponseDto>()); } return(null); }
public async Task <IActionResult> TableArticle([FromBody] NewArticleOfAssociationRequestDto 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.InsertArticlesOfAssociationAsync(user.Sub, dto))); }