Ejemplo n.º 1
0
        // GET CREATE PAIN
        public ViewResult Create(int clientID)
        {
            // create view model
            var viewModel = new PainFormViewModel
            {
                ClientId = clientID
            };

            return View("Edit", viewModel);
        }
Ejemplo n.º 2
0
        public ActionResult Edit(PainFormViewModel painForm)
        {
            var pain = Mapper.Map<PainFormViewModel, Pain>(painForm);

            if (ModelState.IsValid)
            {
                _clientsRepository.SavePain(pain);
                TempData["message"] = "Pain area: " + pain.PainArea + " has been saved.";
                return RedirectToAction("List", "InitialAssessments", new { pain.ClientId });
            }
            return View("Edit", painForm);
        }