public async Task <ApplicationResponseDto> InsertAmendedArticles(Guid user, NewAmendedArticlesRequestDto dto) { var application = await GetPrivateEntityApplicationAsync(user, dto.ApplicationId); application.PrivateEntity.ArticlesOfAssociation ??= new ArticlesOfAssociation(); application.PrivateEntity.ArticlesOfAssociation.AmendedArticles = _mapper.Map <List <AmendedArticle> >(dto.AmendedArticles); return(await ReturnApplicationResponse(application)); }
public async Task <ApplicationResponseDto> AmendedArticlesAsync(NewAmendedArticlesRequestDto dto) { var response = await _client.PostAsJsonAsync("entity/amended/articles", dto); if (response.IsSuccessStatusCode) { return(await response.Content.ReadAsAsync <ApplicationResponseDto>()); } return(null); }
public async Task <IActionResult> AmendedArticles([FromBody] NewAmendedArticlesRequestDto 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.InsertAmendedArticles(user.Sub, dto))); }