public async Task <IActionResult> SaveOrder([FromBody] OrderRequest request) { var employeeId = int.Parse(User.FindFirstValue("id")); var ingredients = await _drinkService.GetDrinkIngredientByIdAsync(request.DrinkId); var drinkRequest = new DrinkRequest( ingredients.Select(i => new DrinkRequest.Ingredient( i.Ingredient.Name, request.GetIngredientAmountOrDefault(i.DrinkIngredientId, i.Amount) )), request.Mug ); await _coffeeMachine.MakeDrink(drinkRequest); await _preferenceService.SavePreferenceAsync(new PreferenceDto { EmployeeId = employeeId, DrinkId = request.DrinkId, Amounts = request.Amounts, Mug = request.Mug }); return(Ok(true)); }