Esempio n. 1
0
 public async Task RestoreFromLocalStorage(IEnumerable <ArchiveEntry> files)
 {
     await Task.Run(() =>
     {
         var tripFile       = files.FirstOrDefault(x => x.Name == Constants.BackupTripsFileName);
         var accommFile     = files.FirstOrDefault(x => x.Name == Constants.BackupAccommodationsFileName);
         var trips          = serializer.Deserialize <IEnumerable <Trip> >(tripFile.Content as string);
         var accommodations = serializer.Deserialize <IEnumerable <Accommodation> >(accommFile.Content as string);
         tripRepository.AddOrReplace(trips);
         accommodationRepository.AddOrReplace(accommodations);
     });
 }