Пример #1
0
        public ActionResult DoctorIndex([FromForm] string searchString)
        {
            try
            {
                Regex          regex = new Regex("[0-9]");
                List <Patient> patient;
                if (regex.IsMatch(searchString))
                {
                    patient = PatientTable.GetPatientByPesel(System.Convert.ToInt32(searchString));
                }
                else
                {
                    patient = PatientTable.GetPatientBySurname(searchString);
                }

                if (patient.Count == 0)
                {
                    return(View());
                }
                else
                {
                    return(RedirectToAction("DoctorView", "Doctor", patient[0]));
                }
            }
            catch {
                return(View());
            }
        }