Exemplo n.º 1
0
 public IActionResult OnPostOk()
 {
     if (ModelState.IsValid)
     {
         if (Agency.ToursId == null)
         {
             Agency.ToursId = new List <string>();
         }
         _tourList.SynchronizeUpdating(Agency);
         _agencyList.Update(Agency);
         return(RedirectToPage("TravelAgencies", new { userId = UserId }));
     }
     return(Page());
 }
Exemplo n.º 2
0
 public static void SynchronizeDeleting(this IAgencyCollection agencyList, Tour tour)
 {
     if (tour.AgenciesId == null)
     {
         return;
     }
     foreach (TravelAgency agency in agencyList.TravelAgencies)
     {
         TravelAgency newAgency = agency;
         if (newAgency.ToursId.Contains(tour.Id))
         {
             newAgency.ToursId.Remove(tour.Id);
             agencyList.Update(newAgency);
         }
     }
 }