@@ -55,6 +55,7 @@ Microsoft offers. To do this, run the following commands in your terminal:
55
55
To add the {+driver-short+} to your project as a dependency, run the following command:
56
56
57
57
.. code-block:: bash
58
+
58
59
dotnet add package MongoDB.Driver
59
60
60
61
The preceding commands create a new web application project for .NET core named
@@ -82,7 +83,7 @@ the data model for your RESTful API.
82
83
:language: csharp
83
84
:dedent:
84
85
85
- The precedeing code defines a class named ``MongoDBSettings`` that
86
+ The preceding code defines a class named ``MongoDBSettings`` that
86
87
contains information about your connection, the database name, and the
87
88
collection name.
88
89
@@ -178,4 +179,33 @@ the data model for your RESTful API.
178
179
be ``username`` in C#, in JSON, and in MongoDB.
179
180
180
181
You now have a MongoDB service and document model for your collection to work
181
- with for .NET Core.
182
+ with for .NET Core.
183
+
184
+ Build CRUD Endpoints
185
+ --------------------
186
+
187
+ To create the CRUD endpoints for this application, you need to update two
188
+ different files within the project. In this section, you can learn how to define
189
+ the endpoint within a controller and update the corresponding work within the
190
+ service.
191
+
192
+ .. procedure:: Build endpoints to interact with MongoDB
193
+ :style: connected
194
+
195
+ .. step:: Create a controller
196
+
197
+ In your project, create a folder named ``Controllers``. In the
198
+ ``Controllers`` folder, create a new file named ``PlaylistController.cs``
199
+ and add the following code:
200
+
201
+ .. literalinclude:: /includes/fundamentals/code-examples/restful-api-tutorial/PlaylistControllerSetup.cs
202
+ :language: csharp
203
+ :dedent:
204
+
205
+ The ``PlaylistController`` class contains a constructor method that gains
206
+ access to your singleton service class. Then, there is a series of
207
+ endpoints for this controller.
208
+
209
+ .. step:: Add data through the POST endpoing
210
+
211
+ Navigate to ``Services/MongoDBService.cs`` and add the following code:
0 commit comments