Beispiel #1
0
 public async Task RefreshReservations(bool silent = false)
 {
     if (IsLoadingResrvations)
     {
         return;
     }
     IsLoadingResrvations = silent ? false : true;;
     await Task.Run(async() =>
     {
         try
         {
             List <Reservations> reservations = (await _reservationsController.GetAllEntries())?.Where(r => r.Person_Id == CurrentLoginInfo.ID)?.ToList();
             if (reservations == null || reservations?.Count <= 0)
             {
                 if (!silent)
                 {
                     Toast = "No reservations available";
                 }
             }
             else
             {
                 Reservations.AddRange(reservations, true);
                 AvailableReservations.AddRange(reservations.Where(r => r.IsAvailable), true);
             }
         }
         catch (Exception e)
         {
             if (!silent)
             {
                 Toast = "Bad network \n" + e.Message;
             }
         }
         finally
         {
             IsLoadingResrvations = false;
         }
     });
 }