Ejemplo n.º 1
0
        public async Task OnGetAsync()
        {
            if (AvailableDoctors == null)
            {
                var availableDoctors = await _appointmentsService.GetAllAvailableDoctors();

                AvailableDoctors = new SelectList(availableDoctors, nameof(Doctor.UserId), nameof(Doctor.FullName));
            }
            if (AvailableReasons == null)
            {
                var curentCulture = CurentCultureUtils.GetCurrentCulture();
                var reasonFromApi = await _appointmentsService.GetAllAppointmentReasons();

                var reasons = reasonFromApi.Select(reason =>
                                                   new
                {
                    Id    = reason.ReasonId,
                    Value = reason.LangReasonDictionary[curentCulture]
                })
                              .ToList();
                AvailableReasons = new SelectList(reasons, "Id", "Value");
            }
        }