public List <RestaurantInformationAverage> getTopList() { ReadingFromFile <RestaurantInformation> listFile = new ReadingFromFile <RestaurantInformation>(); RestaurantInformationPecentageAverage restaurant = new RestaurantInformationPecentageAverage(); List <RestaurantInformationAverage> listRestaurants = restaurant.GetListWithPercentageAverage(listFile.Read()); listRestaurants.Sort(); return(listRestaurants); }
public static string getAverageOfLiquid(RestaurantInformation restaurantInformation) { ReadingFromFile <RestaurantInformation> listFile = new ReadingFromFile <RestaurantInformation>(); RestaurantInformationPecentageAverage restaurant = new RestaurantInformationPecentageAverage(); List <RestaurantInformationAverage> listRestaurants = restaurant.GetListWithPercentageAverage(listFile.Read()); foreach (RestaurantInformationAverage restaurantsInformation in listRestaurants) { if (restaurantsInformation.Name.Equals(restaurantInformation.Name) && restaurantsInformation.Address.Equals(restaurantInformation.Address)) { return(restaurantsInformation.AverageOfPercentage.ToString()); } } return("-"); }
public List <RestaurantInformationAverage> GetLastDaysData(int days) { ReadingFromFile <RestaurantInformation> readingFromFile = new ReadingFromFile <RestaurantInformation>(); List <RestaurantInformation> dataList = readingFromFile.Read(); List <RestaurantInformation> dataListRange = new List <RestaurantInformation>(); foreach (RestaurantInformation restaurantData in dataList) { if (restaurantData.Date.AddDays(days) >= DateTime.Today) { dataListRange.Add(restaurantData); Console.WriteLine(restaurantData.Date); } } RestaurantInformationPecentageAverage restaurant = new RestaurantInformationPecentageAverage(); List <RestaurantInformationAverage> listRestaurants = restaurant.GetListWithPercentageAverage(dataListRange); return(listRestaurants); }