public ActionResult Edit(int tourId) { var tour = _tourQueryService.FindTour(tourId); var tourEdit = Mapper.Map <TourEdit>(tour); tourEdit.AvailabilityStatusList = _tourQueryService.Availabilities(); tourEdit.CategoryList = _tourQueryService.Categories(); tourEdit.CategoriesFromPost = new System.Collections.Generic.List <string>(); if (tour.SEOTools != null && tour.SEOTools.Count > 0) { SEOTool SEOTool = tour.SEOTools.First(); tourEdit.SEOTitle = SEOTool.SEOTitle; tourEdit.FocusKeyword = SEOTool.FocusKeyword; tourEdit.MetaDescription = SEOTool.MetaDescription; } foreach (Category cat in tour.Categories) { tourEdit.CategoriesFromPost.Add(cat.Id.ToString()); } tourEdit.TourTypeList = _tourQueryService.TourTypes(); return(View(tourEdit)); }