Esempio n. 1
0
        public IActionResult EmployeeDecline(DeclineAppointmentViewModel appointmentModel)
        {
            appointmentService.DeclineAppointment(appointmentModel.Id, appointmentModel.Description);

            if (!this.ModelState.IsValid)
            {
                return(View(appointmentModel));
            }

            var scheduleId = scheduleService.GetScheduleIdByAppointmentId(appointmentModel.Id);

            return(Redirect($"/Admin/Schedules/EmployeeSchedule/{scheduleId}"));
        }
        public IActionResult ClientDecline(DeclineAppointmentViewModel appointmentModel)
        {
            var userId = this.userService.GetUserId(this.User);

            if (!this.appointmentService.BelongsToUser(userId, appointmentModel.Id))
            {
                return(Unauthorized());
            }

            if (!this.ModelState.IsValid)
            {
                return(View(appointmentModel));
            }

            appointmentService.DeclineAppointment(appointmentModel.Id, appointmentModel.Description);

            return(Redirect($"/Appointments/MyAppointments"));
        }