From baa6f30b8cb361b6f0fe95e12487ccf6dc6e101b Mon Sep 17 00:00:00 2001 From: Markus Meyer Date: Sat, 29 Feb 2020 08:25:37 +0100 Subject: [PATCH] #66 Meal Service updated --- PlanB.Butler.Services/PlanB.Butler.Services/Constants.cs | 4 ++-- PlanB.Butler.Services/PlanB.Butler.Services/MealService.cs | 4 +--- .../PlanB.Butler.Services/RestaurantService.cs | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/PlanB.Butler.Services/PlanB.Butler.Services/Constants.cs b/PlanB.Butler.Services/PlanB.Butler.Services/Constants.cs index ad3cb6b..7341035 100644 --- a/PlanB.Butler.Services/PlanB.Butler.Services/Constants.cs +++ b/PlanB.Butler.Services/PlanB.Butler.Services/Constants.cs @@ -15,11 +15,11 @@ internal static class Constants /// /// The butler correlation trace name. /// - internal const string ButlerCorrelationTraceName = "Butler-Correlation-Id"; + internal const string ButlerCorrelationTraceName = "ButlerCorrelationId"; /// /// The butler correlation trace header. /// - internal const string ButlerCorrelationTraceHeader = "ButlerCorrelationId"; + internal const string ButlerCorrelationTraceHeader = "Butler-Correlation-Id"; } } diff --git a/PlanB.Butler.Services/PlanB.Butler.Services/MealService.cs b/PlanB.Butler.Services/PlanB.Butler.Services/MealService.cs index 6bafb56..7c61124 100644 --- a/PlanB.Butler.Services/PlanB.Butler.Services/MealService.cs +++ b/PlanB.Butler.Services/PlanB.Butler.Services/MealService.cs @@ -90,8 +90,7 @@ public static async Task CreateMeal( var metaDate = mealModel.Date.ToString("yyyyMMdd", CultureInfo.InvariantCulture); blob.Metadata.Add(MetaDate, metaDate); blob.Metadata.Add(MetaRestaurant, mealModel.Restaurant); - - // blob.Metadata.Add(Constants.ButlerCorrelationTraceName, correlationId.ToString().Replace("-", string.Empty)); + blob.Metadata.Add(Constants.ButlerCorrelationTraceName, correlationId.ToString().Replace("-", string.Empty)); var meal = JsonConvert.SerializeObject(mealModel); trace.Add("meal", meal); @@ -116,7 +115,6 @@ public static async Task CreateMeal( }; actionResult = new BadRequestObjectResult(errorModel); - throw; } finally { diff --git a/PlanB.Butler.Services/PlanB.Butler.Services/RestaurantService.cs b/PlanB.Butler.Services/PlanB.Butler.Services/RestaurantService.cs index 8e5feb9..0240aa5 100644 --- a/PlanB.Butler.Services/PlanB.Butler.Services/RestaurantService.cs +++ b/PlanB.Butler.Services/PlanB.Butler.Services/RestaurantService.cs @@ -126,7 +126,7 @@ public static async Task CreateRestaurant( RestaurantModel restaurantModel = JsonConvert.DeserializeObject(requestBody); - var filename = $"{restaurantModel.Name}.json"; + var filename = $"{restaurantModel.Name}-{restaurantModel.City}.json"; trace.Add($"filename", filename); req.HttpContext.Response.Headers.Add(Constants.ButlerCorrelationTraceHeader, correlationId.ToString()); @@ -140,6 +140,7 @@ public static async Task CreateRestaurant( trace.Add("restaurant", restaurant); Task task = blob.UploadTextAsync(requestBody); + task.Wait(); } log.LogInformation(correlationId, $"'{methodName}' - success", trace); @@ -159,7 +160,6 @@ public static async Task CreateRestaurant( }; actionResult = new BadRequestObjectResult(errorModel); - throw; } finally {