public void NewButton_Pressed(object sender, RoutedEventArgs e) { if (!AllItems.Any() || AllItems.Count == ComboBoxBindingSources.Count) { return; } var remainingItems = AllItems.Where(x => ChosenItems.All(y => x.ID != y.ID)).ToList(); ComboBoxBindingSources.Add(new ComboBoxBindingSource(remainingItems.First(), remainingItems)); RefreshAvailableItems(); }
public ActionResult RemoveItem(long itemId) { var item = ChosenItems.FirstOrDefault(i => i.Id == itemId); if (item != null) { ChosenItems.Remove(item); } return(PartialView("~/Views/Plan/ChosenDestinations.cshtml", ChosenItems)); }
// GET: Routing public ActionResult Index(long townId) { var homeTown = routingService.GetHomeCoordinates(townId); // insert the home town for calculations: ChosenItems.Insert(0, homeTown); LastOrderedList = tspService.SolveTsp(ChosenItems); // Remove hometown after calculations are done: ChosenItems.Remove(homeTown); return(View(LastOrderedList)); }
public ActionResult GetDestinationInfo(long itemId) { var item = ChosenItems.FirstOrDefault(i => i.Id == itemId); if (item == null) { UserRoutes.ForEach(r => { item = r.Destinations?.FirstOrDefault(d => d.Id == itemId) ?? item; }); } if (item != null) { return(PartialView("~/Views/Plan/DestinationInfo.cshtml", item)); } return(Json(null)); }