コード例 #1
0
        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 });
        }
コード例 #2
0
        // 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);
        }