public async Task CreateFoodRequestAsync(FoodItemRequest foodItems) { GrpcChannel channel = GrpcChannel.ForAddress("http://*****:*****@response}", response); }
public async Task <IActionResult> PostFoodGrpc([FromBody] FoodItemRequest request) { if (request == null) { return(BadRequest()); } await _service.CreateGrpcFoodRequestAsync(request); return(Accepted()); }
public async Task CreateFoodItems(FoodItemRequest foodItemRequest) { var restaurantList = await GetRestaurants(); if (restaurantList == null || restaurantList.Count < 1) { throw new ArgumentNullException(); } var restaurant = restaurantList.Find(a => a.Name == foodItemRequest.RestaurantName); if (restaurant == null) { throw new ArgumentNullException("Restaurant has to be an existing Restaurant"); } var foodContent = new StringContent(JsonConvert.SerializeObject(foodItemRequest), System.Text.Encoding.UTF8, "application/json"); var responseString = await _httpClient.PostAsync($"{_foodUrl}/food", foodContent); }
public async Task CreateGrpcFoodRequestAsync(FoodItemRequest foodItems) { _logger.LogInformation("grpc client created"); AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", true); GrpcChannel channel = GrpcChannel.ForAddress("https://*****:*****@response}", response); }
public async Task AddFoodItemAsync(FoodItemRequest foodItem) { //TODO: Add tests await _mediator.Send(foodItem); }