public DishModel() { State = new SuspiciousState() { Index = 0 }; IsItPublic = true; NutritionFacts = new NutritionFactsViewModel(); }
//======================================================================================================================================================================================= private static SuspiciousState GetRestauranMappedState(RestaurantBasicData restaurantData) { SuspiciousState returnValue = new SuspiciousState(); List<Dish> allRestourantDishes = new List<Dish>(); if (restaurantData.Menu != null && restaurantData.Menu.MenuParts != null) { foreach (var menuPart in restaurantData.Menu.MenuParts) { if(menuPart.Dishes != null) allRestourantDishes.AddRange(menuPart.Dishes); } } if (allRestourantDishes.Count() > 0) returnValue.Index = allRestourantDishes.Average(c => c.State.Index); return returnValue; }