Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            AppointmentRepository repository  = new AppointmentRepository();
            Appointment           appointment = repository.GetById(id);

            repository.Delete(appointment);
            return(RedirectToAction("AppointmentList"));
        }
Beispiel #2
0
        public ActionResult Delete(int id)
        {
            AppointmentRepository repo = new AppointmentRepository();
            Appointment           item = repo.GetById(id);

            repo.Delete(item);

            return(RedirectToAction("Index", "Appointments", new { DoctorId = item.DoctorId }));
        }
Beispiel #3
0
 public ActionResult Delete(int id, AppointmentModel Appt)
 {
     try
     {
         AppointmentRepository.Delete(id);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
 public IActionResult DeleteAppointment(string userName, int appointmentId)
 {
     if (loggedInPatients.checkIfLoggedIn(userName))
     {
         var appointment = appointmentRepository.GetByID(appointmentId);
         appointmentRepository.Delete(appointment);
         return(Ok());
     }
     else
     {
         return(Ok());
     }
 }
Beispiel #5
0
        public ActionResult Delete(Guid id, FormCollection collection)
        {
            Appointment appointment = appointmentRepository.GetById(id);

            try
            {
                DateTime date = appointment.DateTime;
                appointmentRepository.Delete(id);
                appointmentRepository.Save();
                return(RedirectToAction("Index", new { date = date.ToString("yyyy-MM-dd") }));
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", "Error at delete appointment: " + e.Message);
                return(View("Delete", appointment));
            }
        }
Beispiel #6
0
 public bool DeleteAppointment(Appointment appt)
 {
     return(_ar.Delete(appt));
 }
 public void DeleteAppointment(Appointment appointment)
 {
     appointmentRepository.Delete(appointment.SerialNumber);
 }
 public void Remove(int appointmentid, int operationid)
 {
     appointmentRepository.Delete(appointmentid);
 }
Beispiel #9
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Lista  ss    = (Lista)dataGridTermini.Items.GetItemAt(dataGridTermini.SelectedIndex);
            string name1 = sender.ToString();

            string[] words = name1.Split(':');

            string[] words1 = name1.Split(' ');
            string   id     = words1[2];


            string sMessageBoxText = "Da li ste sigurni da zelite da otkazete ovaj termin?" + id;
            string sCaption        = "Otkazivanje termina.";

            MessageBoxButton btnMessageBox  = MessageBoxButton.YesNoCancel;
            MessageBoxImage  icnMessageBox  = MessageBoxImage.Warning;
            MessageBoxResult rsltMessageBox = MessageBox.Show(sMessageBoxText, sCaption, btnMessageBox, icnMessageBox);

            switch (rsltMessageBox)
            {
            case MessageBoxResult.Yes:
                PatientUser ovajPacijent = new PatientUser();

                String o = bingPathToAppDir(@"JsonFiles\operations.json");
                String b = bingPathToAppDir(@"JsonFiles\appointments.json");

                AppointmentList = new List <DoctorAppointment>();
                operationList   = new List <Operation>();

                OperationRepository   oprep = new OperationRepository(o);
                AppointmentRepository epr   = new AppointmentRepository(b);
                operationList   = oprep.GetAll();
                AppointmentList = epr.GetAll();


                foreach (DoctorAppointment d in AppointmentList)
                {
                    if (d.id.ToString().Equals(id) && ss.Pregled == true)
                    {
                        Console.WriteLine(id);
                        AppointmentList.Remove(d);
                        //patientController.update(ovajPacijent);
                        epr.Delete(d.id);
                        PatientController patContr = new PatientController();


                        if (d.patient.notifications == null)
                        {
                            d.patient.notifications = new List <ModelNotification>();
                        }
                        List <ModelNotification> notifications1 = d.patient.notifications;
                        // }

                        notifications1.Add(new ModelNotification("Postovani, pregled zakazan za datum: " + d.date + " i vreme " + d.time + " je otkazan."));
                        d.patient.notifications = notifications1;



                        PatientController pCon = new PatientController();
                        pCon.Update(d.patient);

                        if (d.doctor.specialNotifications == null)
                        {
                            d.doctor.specialNotifications = new List <DoctorNotification>();
                        }
                        List <DoctorNotification> obavestenja = d.doctor.specialNotifications;
                        obavestenja.Add(new DoctorNotification("Postovani, pregled zakazan za datum: " + d.date + " i vreme " + d.time + " je otkazan."));
                        d.doctor.specialNotifications = obavestenja;



                        DoctorController docContr1 = new DoctorController();

                        docContr1.Update(d.doctor);
                        var s = new PopunjeniTermini();
                        Panel.Children.Clear();
                        Panel.Children.Add(s);

                        break;
                    }
                }

                foreach (Operation d in operationList)
                {
                    if (d.id.ToString().Equals(id) && ss.Operacija == true)
                    {
                        operationList.Remove(d);
                        oprep.Delete(d.id);

                        if (d.patient.notifications == null)
                        {
                            d.patient.notifications = new List <ModelNotification>();
                        }
                        List <ModelNotification> notifications1 = d.patient.notifications;


                        notifications1.Add(new ModelNotification("Postovani, operacija zakazana za datum: " + d.date + " i vreme " + d.start + " je otkazana."));
                        d.patient.notifications = notifications1;



                        PatientController pCon = new PatientController();
                        pCon.Update(d.patient);



                        if (d.isResponiable.specialNotifications == null)
                        {
                            d.isResponiable.specialNotifications = new List <DoctorNotification>();
                        }
                        List <DoctorNotification> obavestenja = d.isResponiable.specialNotifications;
                        obavestenja.Add(new DoctorNotification("Postovani,operacija zakazana za datum: " + d.date + " i vreme " + d.start + " je otkazana."));
                        d.isResponiable.specialNotifications = obavestenja;



                        DoctorController docContr1 = new DoctorController();

                        docContr1.Update(d.isResponiable);
                        var s = new PopunjeniTermini();
                        Panel.Children.Clear();
                        Panel.Children.Add(s);
                        break;
                    }
                }


                break;


            case MessageBoxResult.No:

                break;

            case MessageBoxResult.Cancel:

                break;
            }
        }
Beispiel #10
0
        public async Task <Appointment> Delete(int id)
        {
            var entity = await _repository.Delete(id);

            return(entity);
        }