Scheduler - Getting Started: Add ASP.NET Core Snippets#9038
Scheduler - Getting Started: Add ASP.NET Core Snippets#9038arman-boyakhchyan wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the Scheduler “Getting Started” documentation by adding ASP.NET Core (DevExtreme Controls) code snippets alongside existing jQuery/Angular/Vue/React examples.
Changes:
- Added ASP.NET Core Scheduler initialization snippet.
- Added ASP.NET Core snippets for core configuration topics (current date, views, editing, adaptive mode, time zone editing).
- Added a larger ASP.NET Core “bind to data” example (Razor + controller + model/data).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/02 Create a Scheduler.md | Adds an ASP.NET Core snippet that creates a Scheduler in Razor. |
| concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/05 Bind the Scheduler to Data.md | Adds ASP.NET Core data binding example with MVC data source + controller/model/data snippets. |
| concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/07 Set the Current Date.md | Adds ASP.NET Core snippet for setting CurrentDate. |
| concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/10 Configure Views.md | Adds ASP.NET Core snippet for configuring views. |
| concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/15 Edit Appointments.md | Adds ASP.NET Core snippet for disabling dragging via Editing. |
| concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/25 Time Zone Support.md | Adds ASP.NET Core snippet for enabling time zone editing via Editing. |
| concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/30 Enable Adaptive Mode.md | Adds ASP.NET Core snippet for enabling adaptivity. |
Comments suppressed due to low confidence (2)
concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/05 Bind the Scheduler to Data.md:130
Updatecan pass a null appointment toPopulateAppointmentand it also does not return anIActionResult. Add a not-found guard and return the updated object (consistent with other ASP.NET Core samples).
public IActionResult Update(int key, string values) {
var appointment = SchedulerData.Appointments.FirstOrDefault(e => e.ID == key);
// ...
PopulateAppointment(appointment, values);
}
concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/05 Bind the Scheduler to Data.md:137
Deletedoes not return anIActionResult, and it can attempt to remove a null appointment if the key is not found. Add a not-found guard and return a result.
public IActionResult Delete(int key) {
var appointment = SchedulerData.Appointments.FirstOrDefault(e => e.ID == key);
// ...
SchedulerData.Appointments.Remove(appointment);
}
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/05 Bind the Scheduler to Data.md:148
Deletecan throw when the specified key is not found (Remove(null)will throw). Add a null check and returnNotFound()when no appointment matches the key.
public IActionResult Delete(int key) {
var appointment = SchedulerData.Appointments.FirstOrDefault(e => e.ID == key);
// ...
SchedulerData.Appointments.Remove(appointment);
return NoContent();
| using System.Linq; | ||
| using System.Text.Json; | ||
| using ASP_NET_Core.Models; | ||
| using DevExtreme.AspNet.Data; | ||
| using DevExtreme.AspNet.Mvc; | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| namespace ASP_NET_Core.Controllers; | ||
|
|
There was a problem hiding this comment.
we can omit this part for brevity
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/05 Bind the Scheduler to Data.md:115
- The
SchedulerDataControllersnippet is missing the standardusingdirectives and anamespacedeclaration. As written, it will not compile when copied into an ASP.NET Core project because types likeController,DataSourceLoadOptions,DataSourceLoader,JsonDocument, and LINQ extensions are not in scope. Add the same header structure used in other ASP.NET Core snippets (for example,concepts/05 UI Components/DataGrid/00 Getting Started with DataGrid/05 Bind the DataGrid to Data.md).
public class SchedulerDataController : Controller {
[HttpGet]
public object Get(DataSourceLoadOptions loadOptions) {
return DataSourceLoader.Load(SchedulerData.Appointments, loadOptions);
}
concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/05 Bind the Scheduler to Data.md:132
Updatecan pass a nullappointmentintoPopulateAppointment(...)when the requested key is not found, which results in aNullReferenceException. Guard against missing records and return a non-success status code (for example,NotFound()) before callingPopulateAppointment.
[HttpPut]
public IActionResult Update(int key, string values) {
var appointment = SchedulerData.Appointments.FirstOrDefault(e => e.ID == key);
// ...
PopulateAppointment(appointment, values);
return Ok(appointment);
}
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (2)
concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/15 Edit Appointments.md:79
- This section refers to DevExtreme "events" (options like
onAppointmentAdding), not "event handlers" being called by Scheduler. Also, theonAppointmentDeletinglink is inconsistent with the other two and should point to the API reference Markdown page.
When users add, edit, or delete appointments, Scheduler calls the following event handlers:
- [onAppointmentAdding](/api-reference/10%20UI%20Components/dxScheduler/1%20Configuration/onAppointmentAdding.md '/Documentation/ApiReference/UI_Components/dxScheduler/Configuration/#onAppointmentAdding/')
- [onAppointmentUpdating](/api-reference/10%20UI%20Components/dxScheduler/1%20Configuration/onAppointmentUpdating.md '/Documentation/ApiReference/UI_Components/dxScheduler/Configuration/#onAppointmentUpdating/')
- [onAppointmentDeleting](/Documentation/ApiReference/UI_Components/dxScheduler/Configuration/#onAppointmentDeleting)
concepts/05 UI Components/Scheduler/00 Getting Started with Scheduler/15 Edit Appointments.md:81
- After switching to "events" above, this sentence should also refer to events (not handlers) and include the article before Scheduler.
You can use these handlers to extend Scheduler's functionality. The following example configures **onAppointmentAdding** and **onAppointmentUpdating** to prevent adding or moving appointments to cells with existing recurring appointments:
No description provided.