public ActionResult EditTour(int id) { OrderedTour tour = tourMan.GetTourInfo(id); List <OrderedTour_ExcursionSight> excursionSight = excMan.GetExcursionSightInfo(id); List <string> excursionSightArray = new List <string>(); for (int i = 0; i < excursionSight.Count; i++) { foreach (var x in excursionSight) { if (x.OrdinalNumber == i && x.ExcursionSightId.HasValue) { excursionSightArray.Add((ExcursionManager.GetExcursionSightName((int)x.ExcursionSightId)).ExcursionSightName); } } } TourModel tourM = new TourModel { OrderedTourId = tour.OrderedTourId, Date = tour.Date, ExcursionName = tour.Excursion.ExcursionName, ClientName = tour.Client.FirstName + " " + tour.Client.LastName, ExcursionSight = excursionSightArray }; if (tour != null) { return(Json(RenderPartialViewToString("EditTour", tourM), JsonRequestBehavior.AllowGet)); } return(View("Index")); }
public static int GetExcursionId(string ExcursionName) { int ExcursionId = -1; Excursion ExcursionExist = ExcursionManager.GetExcursionExist(ExcursionName); if (ExcursionExist == null) { Excursion objExcursion = new Excursion { ExcursionName = ExcursionName }; ExcursionId = ExcursionManager.AddNewExcursion(objExcursion); } return(ExcursionExist != null ? ExcursionExist.ExcursionId : ExcursionId); }
public static int GetExcursionSightId(string ExcursionSightName, int ExcursionId) { int ExcursionSightId = -1; ExcursionSight ExcursionSightExist; ExcursionSightExist = ExcursionManager.GetExcursionSightExist(ExcursionSightName, ExcursionId); if (ExcursionSightExist == null) { ExcursionSight objSight = new ExcursionSight { ExcursionSightName = ExcursionSightName, ExcursionId = ExcursionId }; ExcursionSightId = ExcursionManager.AddExcursionSight(objSight); } return(ExcursionSightExist != null ? ExcursionSightExist.ExcursionSightId : ExcursionSightId); }