public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Address,PhoneNumber,Email")] Patient patient)
        {
            if (id != patient.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    Core.Models.Patient input = PatientConverter.PatientForDb(patient);

                    var succes = await _patientRepository.UpdatePatientAsync(input);

                    if (succes != 0)
                    {
                        return(RedirectToAction(nameof(Index)));
                    }
                    else
                    {
                        ViewBag.ErrorMessage = "Something went wrong while updating patient list entry, please try again...";
                    }
                }
                catch (SqlException ex)
                {
                    var entry = await _patientRepository.GetPatientByIdAsync(patient.Id);

                    if (entry is null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        ViewBag.ErrorMessage = $"Error: { ex.Message }";
                    }
                }
            }

            return(View(patient));
        }
        public async Task <IActionResult> Create([Bind("FirstName,LastName,Address,PhoneNumber,Email")] Patient patient)
        {
            if (ModelState.IsValid)
            {
                Core.Models.Patient input = PatientConverter.PatientForDb(patient);

                try
                {
                    int success = await _patientRepository.SavePatientAsync(input);

                    if (success != 0)
                    {
                        return(RedirectToAction(nameof(Index)));
                    }
                }
                catch (Exception ex)
                {
                    ViewBag.ErrorMessage = $"Error: { ex.Message }";
                }
            }

            return(View(patient));
        }