public List <RestaurantInformationAverage> GetTopList(String duration) { RestaurantDataAccordingToDurationcs restaurantDataAccordingToDuration = new RestaurantDataAccordingToDurationcs(); List <RestaurantInformation> restaurantInformationDurationList = restaurantDataAccordingToDuration.GetDataAccordingToDuration(duration); DistictRestaurantsWithAverageOfPercentage restaurantAverage = new DistictRestaurantsWithAverageOfPercentage(); IEnumerable <RestaurantInformationAverage> listRestaurants = restaurantAverage.GetListWithAverageOfPercentage(restaurantInformationDurationList); listRestaurants = listRestaurants.OrderByDescending(n => n.AverageOfPercentage); return(listRestaurants.ToList <RestaurantInformationAverage>()); }
public string GetAverageOfLiquid(RestaurantInformation restaurantInformation) { ReadingFromFileDeserialize <RestaurantInformation> restaurantListInFile = new ReadingFromFileDeserialize <RestaurantInformation>(); DistictRestaurantsWithAverageOfPercentage distictRestaurantsWithAverage = new DistictRestaurantsWithAverageOfPercentage(); List <RestaurantInformationAverage> restaurantsListWithAverage = distictRestaurantsWithAverage.GetListWithAverageOfPercentage(restaurantListInFile.Read(fileName: ConfigurationManager.AppSettings["FileName"])); foreach (RestaurantInformationAverage restaurantInformationAveraged in restaurantsListWithAverage) { if (restaurantInformationAveraged.Name.Equals(restaurantInformation.Name) && restaurantInformationAveraged.Address.Equals(restaurantInformation.Address)) { return(restaurantInformationAveraged.AverageOfPercentage.ToString()); } } return("-"); }