public void DeleteNonExistingAppointment()
        {
            var appointment = new Appointment
            {
                AppointmentName = "test",
                AppointmentTime = DateTime.Now
            };

            var deleteResponse = _repository.DeleteAppointment(appointment);

            Assert.IsFalse(deleteResponse);
        }
 public async Task <IHttpActionResult> DeleteAppointment(int AppointmentId, string DeletedBy)
 {
     try
     {
         return(Ok(_repo.DeleteAppointment(AppointmentId, DeletedBy)));
     }
     catch (Exception ex)
     { throw ex; }
 }
        public IActionResult DeleteAppointment(int id, Appointment app)
        {
            Account account = new Account();

            account = HttpContext.Session.getJson <Account>("Account");
            //this calls the method that allows the appointment to be deleted
            appointmentRepository.DeleteAppointment(id, app);
            return(RedirectToAction("Index", "Patient"));
        }
 public HttpResponseMessage DeleteAppointment(int appointmentId)
 {
     try
     {
         int i = appointmentRepository.DeleteAppointment(appointmentId);
         return(Request.CreateResponse(HttpStatusCode.NoContent));
     }
     catch (Exception ex)
     {
         Errors errors = ErrorsHelper.GetErrors(ex);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, errors));
     }
 }
 public ActionResult Delete(int id, IFormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         _repo.DeleteAppointment(id);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
Exemple #6
0
 public IActionResult DeleteAppointment(int appointmentId)
 {
     try
     {
         int i = appointmentRepository.DeleteAppointment(appointmentId);
         return(NoContent());
     }
     catch (Exception ex)
     {
         Errors errors = ErrorsHelper.GetErrors(ex);
         return(StatusCode(StatusCodes.Status500InternalServerError, errors));
     }
 }
Exemple #7
0
        public ActionResult DeleteConfirmed(int id)
        {
            Appointment appointment = appointmentRepository.GetAppointmentByID(id);

            if (appointmentRepository.ValidForDelete(appointment))
            {
                appointmentRepository.DeleteAppointment(id);
                appointmentRepository.Save();
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError("AppointmentDate", "Is not possible to cancel the appointment, you must cancel with less than 24 hours");
                return(View(appointment));
            }
        }
 public ActionResult Delete(Appointment appointment)
 {
     try
     {
         service.DeleteAppointment(appointment.EventId);
         repository.DeleteAppointment(appointment.EventId);
         return(View("Appointment", repository.Appointments));
     }
     catch (Exception e)
     {
         if (e.Message == "Caller needs to authenticate.")
         {
             return(new EmptyResult());
         }
         return(RedirectToAction("Index", "Error", new { message = Request.RawUrl + ": " + e.Message }));
     }
 }
        public IActionResult DeleteAppointment(int id)
        {
            if (id == 0)
            {
                return(BadRequest());
            }

            var appointmentToDelete = _appointmentRepository.GetAppointmentById(id);

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

            _appointmentRepository.DeleteAppointment(id);

            return(NoContent());
        }
        public async Task <IActionResult> DeleteAppointment([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var appointment = await repository.GetAppointmentAsync(id);

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

            repository.DeleteAppointment(appointment);
            await unitOfWork.CompleteAsync();

            return(Ok());
        }
Exemple #11
0
        public ActionResult DeleteAppointment(int id)
        {
            var appointment = _appointmentRepository.GetAppointment(id);

            if (appointment != null)
            {
                // delete appointment
                var deleted = _appointmentRepository.DeleteAppointment(appointment);

                if (deleted)
                {
                    return(RedirectToAction("Index", new { date = appointment.Date }));
                }

                return(new HttpStatusCodeResult(400));
            }

            return(HttpNotFound());
        }
Exemple #12
0
        public async Task <ActionResult> GetAppointments(string Id, string Date, Models.AppointmentDto appointment)
        {
            await _appointmentService.Initialize();

            List <Appointment> app = new List <Appointment>();

            if (Date != null)
            {
                app = await _appointmentService.GetAppointmentByPatient(Date);
            }
            else if (Id != null)
            {
                List <Appointment> app2 = new List <Appointment>();
                app2 = await _appointmentService.GetAppointmentById(Id);

                _appointmentRepository.DeleteAppointment(Id);
                app = await _appointmentService.GetAppointmentByPatient(app2[0].PartitionKey);

                Sender sender = new Sender();
                Console.WriteLine(sender.Publish(app2[0].DOB));
                return(RedirectToAction("GetAppointments", "Appointment", new { Date = app2[0].PartitionKey }));
            }
            return(View(app));
        }
 public Response <AppointmentViewModel> DeleteAppointment(long id, DateTime modifiedOn)
 {
     modifiedOn = modifiedOn.ToUniversalTime();
     return(appointmentRepository.DeleteAppointment(id, modifiedOn));
 }
Exemple #14
0
 public JsonResult DeleteAppointment(long id, DateTime modifiedOn)
 {
     modifiedOn = modifiedOn.ToUniversalTime();
     return(Json(appointmentRepository.DeleteAppointment(id, modifiedOn)));
 }
        public IActionResult Delete(int appointmentId)
        {
            Appointment deletedAppoint = repository.DeleteAppointment(appointmentId);

            return(RedirectToAction("Index"));
        }
Exemple #16
0
 public async Task <Appointment> DeleteAppointment(int appointmentId)
 {
     return(await _appointmentRepository.DeleteAppointment(appointmentId));
 }
        public IActionResult Delete(int id)
        {
            var result = _apprepo.DeleteAppointment(id);

            return(RedirectToAction("ListAppointments"));
        }
Exemple #18
0
 public ActionResult DeleteAppointment(Appointment appointment)
 {
     appointmentRepository.DeleteAppointment(appointment);
     return(PartialView("Appointments"));
 }