public ActionResult Create() { var perspectiveEdit = new PerspectiveEdit { /*Commented -> Category replaced by tours CategoryList = _perspectiveQueryService.Categories(), CategoriesFromPost = new System.Collections.Generic.List<string>() */ TourList = _tourQueryService.Tours() }; return View(perspectiveEdit); }
public ActionResult Create(PerspectiveEdit perspectiveEdit) { if (ModelState.IsValid) { /*Commented -> Category replaced by tours perspectiveEdit.SelectedCategories = new System.Collections.Generic.List<int>(); foreach (string s in perspectiveEdit.CategoriesFromPost) perspectiveEdit.SelectedCategories.Add(Convert.ToInt32(s)); */ var perspectivePostUpdate = Mapper.Map<PerspectivePostUpdate>(perspectiveEdit); perspectivePostUpdate.UserId = UserContext.UserId; perspectivePostUpdate.Permalink = perspectivePostUpdate.Headline.Replace(" ", "_"); _perspectiveCommandService.Add(perspectivePostUpdate); TempData["Success"] = "Blog created successfully."; var tour = _tourQueryService.FindTour(perspectiveEdit.TourId); TempData["PerspectivesPermalink"] = perspectivePostUpdate.Permalink; TempData["TourPermalink"] = tour.Permalink; return RedirectToRoute("create-perspective"); } /*Commented -> Category replaced by tours if (perspectiveEdit.CategoriesFromPost == null) perspectiveEdit.CategoriesFromPost = new System.Collections.Generic.List<string>(); perspectiveEdit.CategoryList = _perspectiveQueryService.Categories(); */ perspectiveEdit.TourList = _tourQueryService.Tours(); return View(perspectiveEdit); }