コード例 #1
0
        public async Task <IActionResult> AddPatient(AddPatientModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("/Views/Dashboard/Doctor/AddPatient.cshtml", model));
            }

            var result = await _doctorService.AddPatient(model.FirstName, model.LastName, model.EGN, model.PhoneNumber, model.BirthDate, model.Gender);

            if (result.Succeeded)
            {
                return(RedirectToAction("Index"));
            }

            foreach (var err in result.Errors)
            {
                ModelState.AddModelError("", err);
            }

            return(View("/Views/Dashboard/Doctor/AddPatient.cshtml", model));
        }