Exemplo n.º 1
0
        public ActionResult AddPatient(AddEditPatientViewModel patientRequest)
        {
            if (ModelState.IsValid)
            {
                var patient = Mapper.Map <AddEditPatientViewModel, Patient>(patientRequest);
                var created = _patientRepository.Create(patient);

                if (created)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View(patientRequest));
        }
Exemplo n.º 2
0
        public ActionResult EditPatient(AddEditPatientViewModel editPatient)
        {
            if (ModelState.IsValid)
            {
                var patient = Mapper.Map <AddEditPatientViewModel, Patient>(editPatient);
                var updated = _patientRepository.Update(patient);

                if (updated)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View(editPatient));
        }