|
<EjsSchedule TValue="Appointment" Height="650px" SelectedDate="@(DateTime.Now)">
<ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings>
<ScheduleEvents TValue="Appointment" OnActionBegin="ActionBegin" />
</EjsSchedule>
@code {
public async Task ActionBegin(ActionEventArgs<Appointment> args)
{
var IsServerError = await UpdateData();
if (IsServerError)
{
args.Cancel = true;
}
}
...
} |
|
<EjsSchedule @ref="ScheduleObj" TValue="Appointment" Height="650px" SelectedDate="@(DateTime.Now)">
</EjsSchedule>
@code {
EjsSchedule<Appointment> ScheduleObj;
try
{
if (args.RequestType == BeginEventRemove && args.DeletedRecords.Count > 0)
{
var itemToRemove = args.DeletedRecords.FirstOrDefault();
await Service.DeleteMothod(itemToRemove.Id);
}
}
catch (InvalidOperationException ioe)
{
ToastService.ShowToast(new ToastDetail()
{
ScheduleObj.RefreshEvents(); // To refresh the scheduler events
Level = ToastLevel.Error,
Message = "Error",
SubMessages = new List<string>() { ioe.Message }
});
}
...} |