public ActionResult Create(PracticeViewModel practiceViewModel) { if (ModelState.IsValid) { var practiceModel = AutoMapper.Mapper.Map<PracticeViewModel, Practice>(practiceViewModel); this.practiceService.Add(practiceModel); } return RedirectToAction("Index", new { perspectiveId = practiceViewModel.PerspectiveId }); }
// GET: Practice/Create public ActionResult Create(int perspectiveId) { var practice = this.practiceService.GetById(perspectiveId); PracticeViewModel practiceViewModel = new PracticeViewModel(); practiceViewModel.PerspectiveId = perspectiveId; ViewBag.Practice = practice; return View(practiceViewModel); }