Exemplo n.º 1
0
        public async Task <IActionResult> Create(PatientViewModel patientVM)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    await PatientsHelper.AddPatientAsync(patientVM);

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (DbUpdateException)
            {
                //Log the error
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            return(View(patientVM));
        }