/// <summary> /// Adds the new feedbacks or route if not exist. /// </summary> /// <param name="client">The client.</param> /// <param name="routeFeedbacksModel">The route feedbacks model.</param> public static string AddNewFeedbacksOrRouteIfNotExist(IRoadsService client, AddRoadModelForStepTwo routeFeedbacksModel) { List<RouteNodeWithFeedbacksData> routeNodeWithFeedbacks = new List<RouteNodeWithFeedbacksData>(); int userId = client.GetUserIdOrCreateNewIfNotExist(routeFeedbacksModel.UserName, routeFeedbacksModel.UserName, "TestUserRole"); routeFeedbacksModel.Feedbacks.ForEach(feedback => { routeNodeWithFeedbacks.Add(new RouteNodeWithFeedbacksData() { DestinationCityNodeId = int.Parse(feedback.DestinationCityNodeId), OriginCityNodeId = int.Parse(feedback.OriginCityNodeId), OriginCityNode = feedback.OriginCityName, DestinationCityNode = feedback.DestinationCityName, SubmitTime = DateTime.Now, UserId = userId, FeedbackValues = feedback.FeedbackValues.Select(feedbackValue => new FeedbackValueData() { FeedbackItemId = feedbackValue.FeedbackItemId.Value, Value = feedbackValue.Value == "undefined" ? "" : feedbackValue.Value }).ToArray() }); }); return client.AddFeedbacksToNewOrExistingRoutes(routeNodeWithFeedbacks.ToArray()); }