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)); }