internal async void LoadAppointment(DateTime date) { Appointment appointment = null; ListEntity dadosPatient = new ListEntity { Id = Patient.Id, Name = Patient.NameCompleto }; switch (ConsultationType) { case Appointment._ORIENTACAO: appointment = new Appointment(ConsultationType, "", ResponsibleId, dadosPatient, IdAction, 0, false, false, date, new ObservableCollection <string>(InternCollection.Select(item => item.Id).ToList())); break; case Appointment._GRUPO: appointment = new Appointment(ConsultationType, "", ResponsibleId, dadosPatient, IdAction, 0, false, true, date, new ObservableCollection <string>(InternCollection.Select(item => item.Id).ToList())); break; case Appointment._INDIVIDUAL: appointment = new Appointment(ConsultationType, "", ResponsibleId, dadosPatient, IdAction, 0, false, true, date, new ObservableCollection <string>(InternCollection.Select(item => item.Id).ToList())); break; } var appointmentMarcado = (await appointmentRepository.GetAppointmentByEventIdActionIdAsync(appointment.EventId, IdAction, appointment.Patient.Id)); if (appointmentMarcado == null) { IEnumerable <ScheduleAction> schedulesIndisponiveis = await scheduleActionRepository.GetAppointmentsByIdActionAsync(IdAction); if (schedulesIndisponiveis.FirstOrDefault(x => x.StartTime.DayOfWeek == date.DayOfWeek && x.StartTime.Hour == date.Hour) == null) { var action = await dialogService.DisplayActionSheetAsync("Deseja agendar o atendimento?", "Cancelar", "Agendar"); switch (action) { case "Cancelar": return; case "Agendar": Create(appointment); break; } } } else { appointment = appointmentMarcado; var action = await dialogService.DisplayActionSheetAsync("Selecione a operação desejada:", "Cancelar", null, "Ver detalhes", "Desmarcar"); switch (action) { case "Cancelar": return; case "Ver detalhes": OpenAppointment(appointment); break; case "Desmarcar": Delete(appointment); break; } } }
public async void SaveAsync() { Action.InternCollection = new ObservableCollection <ListEntity>(InternCollection.Where(x => x.Added == true)); //await actionRepository.AddOrUpdateAsync(Action, Action.Id); await NavigationService.GoBackAsync(); }