コード例 #1
0
 public IActionResult OnPostOk()
 {
     if (ModelState.IsValid)
     {
         if (Excursion.ToursId == null)
         {
             Excursion.ToursId = new List <string>();
         }
         _tourList.SynchronizeUpdating(Excursion);
         _excursionList.Update(Excursion);
         return(RedirectToPage("Excursions", new { userId = UserId }));
     }
     return(Page());
 }
コード例 #2
0
 public static void SynchronizeAdding(this IExcursionCollection excursionList, Tour tour)
 {
     if (tour.AgenciesId == null)
     {
         return;
     }
     foreach (Excursion excursion in excursionList.Excursions)
     {
         Excursion newExcursion = excursion;
         if (tour.ExcursionsId.Contains(excursion.Id))
         {
             newExcursion.ToursId.Add(tour.Id);
             excursionList.Update(newExcursion);
         }
     }
 }