public void UpdateTour(Tour tour, HttpPostedFileBase tourThumb, HttpPostedFileBase KrPanoZip) { int?resultingId = null; var existingTour = _tourRepository.GetById(tour.Id); existingTour.Description = tour.Description; existingTour.DescriptionHtml = tour.DescriptionHtml; existingTour.DescriptionJson = tour.DescriptionJson; existingTour.Name = tour.Name; using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = IsolationLevel.ReadCommitted, Timeout = CommonConfiguration.Configuration.TransactionScope_Timeout })) { existingTour.AssetTourThumbnailId = ProcessIncomingImage(existingTour.ClientId, existingTour.CreateUserId.Value, tour.AssetTourThumbnailId, existingTour.AssetTourThumbnailId, tourThumb); existingTour.KrPanoTourId = ProcessIncomingKrPano(existingTour, tour.KrPanoTourId, existingTour.KrPanoTourId, KrPanoZip); resultingId = _tourRepository.UpdateEntity(existingTour); if (resultingId != null) { transaction.Complete(); } } }
public Customization PopulateCustomizationBasedOnEntityValues(int clientId, int locationId, int areaId, int tourId, int?customizationId) { Customization customization = PopulateCustomizationById(customizationId) ?? new Customization(); if (tourId > 0) { customization.EntityName = _tourRepository.GetById(tourId)?.Name; } else if (areaId > 0) { customization.EntityName = _areaRepository.GetById(areaId)?.Name; } else if (locationId > 0) { customization.EntityName = _locationRepository.GetById(locationId)?.Name; } else if (clientId > 0) { customization.EntityName = _clientRepository.GetById(clientId)?.Name; } if (string.IsNullOrWhiteSpace(customization.EntityName)) { customization.EntityName = "Unknown"; } return(customization); }
public ActionResult Details(int?id) { var tour = _tourRepository.GetById((int)id); if (tour == null) { return(HttpNotFound()); } //get destiantions in tour var destinations = _destinatioRepository.GetDestinationByidTour((int)id); string dess = ""; foreach (var item in destinations) { dess += item.Name + " - "; } ViewBag.Destination = dess.Substring(0, dess.Length - 3); string[] listImages = tour.Image.Split('-'); ViewBag.ListImages = listImages; //get remain quantity in tour var remainingQuantity = _tourRepository.GetRemainingQuantity((int)id); ViewBag.Remaining = remainingQuantity; return(View(tour)); }
public void DeleteById(long id) { try { var model = _tourRepo.GetById(id); model.IsDel = true; _tourRepo.Update(model); } catch { throw; } }
// GET: Admin/ToursManagement/Edit/5 public ActionResult Edit(int?id) { var tour = _tourRepository.GetById((int)id); if (tour == null) { return(HttpNotFound()); } ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", tour.CategoryId); ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "Name", tour.EmployeeId); ViewBag.DestiantionId = new SelectList(_destinatioRepository.GetAll().OrderBy(x => x.Name), "Id", "Name"); return(View(tour)); }
public ActionResult OrderTour(int id) { var tour = _tourRepository.GetById(id); ViewBag.Tour = tour; string[] listImages = tour.Image.Split('-'); ViewBag.ListImages = listImages; var remainingQuantity = _tourRepository.GetRemainingQuantity((int)id); ViewBag.Remaining = remainingQuantity; if (Session["username"] == null) { return(RedirectToAction("Login", "Users")); } else { return(View()); } }
public async Task <Tour> GetTourById(int id) { return(await _repository.GetById(id)); }