private async void ShowAppointments()
        {
            //get starting day of selected week
            DateTime dt = CalDate.Date.Value.DateTime;

            DateTime startDay;

            int newd = 0;

            if (dt.DayOfWeek == DayOfWeek.Sunday)
            {
                startDay = dt.AddDays(-6).Date + new TimeSpan(0, 0, 0);
            }
            else
            {
                startDay = dt.AddDays(1 - (int)dt.DayOfWeek).Date + new TimeSpan(0, 0, 0);
            }

            //last day date
            DateTime lastDay = startDay.AddDays(7);

            //get appointments
            List <Appointment>  aps = DAO.GetAppointmetsWeek(startDay);
            List <AppointmentM> apm = await AppointmentMlab.GetAppointmentsWeek(startDay, App.ActualUser.Email);

            //display appointments


            // av.AddAppointments(aps,AppointmentStatus.Active);
            av.AddAppointments(apm, AppointmentStatus.Active);
        }
        private async void DeleteAppointment_Click(object sender, RoutedEventArgs e)
        {
            selectedAppointment.Status = AppointmentStatus.Cancel;
            // DAO.UpdateAppointment(selectedAppointment);
            Debug.WriteLine(selectedAppointment._id);
            await AppointmentMlab.UpdateAppointment(selectedAppointment, App.ActualUser.Email);

            ReloadView();

            DeleteAppointment.IsEnabled = false;
        }
        /// <summary>
        /// Create the new appointment and navigate back
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void AppBarButton_Click(object sender, RoutedEventArgs e)
        {
            Appointment ap = new Appointment();

            ap.Date      = definitive;
            ap.PatientID = ViewModel.Customer.iD;
            ap.Status    = 0;

            long id = App.Data.AddNewAppointment(ap);

            ap.ID = (int)id;
            await AppointmentMlab.AddNewAppointment(ap, App.ActualUser.Email);

            // AppointmentMlab.GetAppointmentsWeek(DateTime.Now, App.ActualUser.Email);
            Frame.GoBack();
        }
        private async void Av_OnUsedSlotTapped(object sender, SlotWithAppointmetTappedEvent e)
        {
            DeleteAppointment.IsEnabled = true;

            av.CleartHighLighted();
            av.HighLightSlot(e.X, e.Y);

            //selectedAppointment = DAO.GetAppointmentByID(e.AppointmentID);

            selectedAppointment = await AppointmentMlab.GetAppointmentByID(e.AppointmentID, App.ActualUser.Email);

            selectedCustomerApp = DAO.GetCustomerByID(selectedAppointment.PatientID);



            NameLabel.Text = selectedCustomerApp.name + " " + selectedCustomerApp.surname;
            DateLabel.Text = selectedAppointment.Date.ToString("dddd, dd MMMM yyyy HH:mm:ss");
        }