Пример #1
0
        public async Task <Fermentable> AddFermentableToRecipe(Fermentable fermentable, int recipeId)
        {
            var request = new CreateFermentableRequest
            {
                Name     = fermentable.Name,
                Color    = fermentable.Color,
                Quantity = fermentable.Quantity
            };

            var result = await _recipeServiceClient.AddFermentableById(recipeId, request);

            return(new Fermentable
            {
                Id = result.Id,
                Name = result.Name,
                Color = result.Color,
                Quantity = result.Quantity
            });
        }
Пример #2
0
        public async Task <FermentableDetailsResponse> AddFermentableById(int recipeId, CreateFermentableRequest request)
        {
            using var client = CreateClient();

            var result = await client.PostJsonAsync($"/v1/recipe/{recipeId}/fermentable", request);

            return(await result.Content.ReadAsAsync <FermentableDetailsResponse>());
        }