public async Task <IActionResult> OnGetAsync(Guid id)
        {
            Instructor = await _instructorRepository.GetInstructorWithChildrenAsync(id);

            if (Instructor == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            Instructor = _mapper.Map <InstructorViewModel>(await _instructorRepository.GetInstructorWithChildrenAsync(id));

            if (Instructor == null)
            {
                return(NotFound());
            }

            return(Page());
        }
        private async Task SetDbErrorMessage(Department dbValues, Department clientValues)
        {
            if (dbValues.DepartmentName != clientValues.DepartmentName)
            {
                ModelState.AddModelError("Department.Name",
                                         $"Current value: {dbValues.DepartmentName}");
            }
            if (dbValues.Budget != clientValues.Budget)
            {
                ModelState.AddModelError("Department.Budget",
                                         $"Current value: {dbValues.Budget:c}");
            }
            if (dbValues.FoundedDate != clientValues.FoundedDate)
            {
                ModelState.AddModelError("Department.StartDate",
                                         $"Current value: {dbValues.FoundedDate:d}");
            }
            if (dbValues.DepartmentChairId != clientValues.DepartmentChairId)
            {
                Instructor dbInstructor = await _instructorRepository.GetInstructorWithChildrenAsync(dbValues.DepartmentChairId ?? new Guid());

                ModelState.AddModelError("Department.InstructorID",
                                         $"Current value: {dbInstructor?.FullName}");
            }

            ModelState.AddModelError(string.Empty,
                                     "The record you attempted to edit "
                                     + "was modified by another user after you. The "
                                     + "edit operation was canceled and the current values in the database "
                                     + "have been displayed. If you still want to edit this record, click "
                                     + "the Save button again.");
        }