Пример #1
0
        public IEnumerable <Tour> GetToursByAreaId(int areaId)
        {
            var tours = _tourRepository.GetByAreaId(areaId).ToList();

            foreach (var tour in tours.Where(x => x.AssetTourThumbnailId != null))
            {
                tour.AssetTourThumbnail = PopulateAssetStoreById(tour.AssetTourThumbnailId);
            }
            return(tours);
        }
Пример #2
0
        public string DeleteArea(Area area)
        {
            string errorMessage = "Failed to delete area";
            var    childTours   = _tourRepository.GetByAreaId(area.Id);

            if (childTours.Count() == 0 && _areaRepository.DeleteEntity(area))
            {
                errorMessage = "";
            }
            else if (childTours.Count() > 0)
            {
                errorMessage = string.Format("Failed to delete area, tours associated with area must be deleted first.", childTours.Count());
            }
            return(errorMessage);
        }