private async Task SaveAppointment()
        {
            if (IsValid())
            {
                if (Appointment.AppointmentId == Guid.Empty)
                {
                    CreateAppointmentRequest toCreate = new CreateAppointmentRequest()
                    {
                        Details           = Title,
                        SelectedDoctor    = (int)Appointment.DoctorId,
                        PatientId         = Patient.PatientId,
                        ClientId          = Patient.ClientId,
                        ScheduleId        = ScheduleId,
                        RoomId            = Appointment.RoomId,
                        AppointmentTypeId = Appointment.AppointmentTypeId,
                        DateOfAppointment = Appointment.Start.DateTime,
                    };

                    await AppointmentService.CreateAsync(toCreate);
                }
                else
                {
                    var toUpdate = UpdateAppointmentRequest.FromDto(Appointment);
                    await AppointmentService.EditAsync(toUpdate);
                }

                await OnAppointmentChanged.InvokeAsync(Appointment.Title);
            }
        }
Example #2
0
        public async Task <IActionResult> Edit([FromRoute] Guid id, [FromBody] AppointmentRequest request)
        {
            try
            {
                var appointment = await appointmentService.EditAsync(id, request);

                return(Ok(appointment));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Example #3
0
        public async Task KendoCall(string action, string jsonData)
        {
            if (action == "edit")
            {
                var result = JsonSerializer.Deserialize <AppointmentDto>(jsonData, JsonOptions);
                await OnEditCallback.InvokeAsync(result);
            }
            else if (action == "move")
            {
                var result = JsonSerializer.Deserialize <AppointmentDto>(jsonData, JsonOptions);
                await AppointmentService.EditAsync(UpdateAppointmentRequest.FromDto(result));
            }
            else if (action == "delete")
            {
                var result = JsonSerializer.Deserialize <AppointmentDto>(jsonData, JsonOptions);
                await AppointmentService.DeleteAsync(result.AppointmentId);

                SchedulerService.Appointments.Remove(SchedulerService.Appointments.First(x => x.AppointmentId == result.AppointmentId));
                CallJSMethod();
            }
        }