From the course: ASP.NET Core: Building a GraphQL API

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Adding your first mutation: Add data

Adding your first mutation: Add data

- [Instructor] On this part, we are going to add our first mutation file. And in this mutation file, we're going to add our first method or the first field. And then we are going to use this field to add new data to the database. So for that, let us go to Visual Studio and see connection. In here, I'll just go to the Solution Explorer, and then you go to the GraphQL. And here since we're going to add our first mutation, let us just right-click and then add a new folder. Let us name this folder, the Mutations, and then right-click, go to Add. We're going to add a new class. We are going to name this class, the CourseMutation. Mutation, and then click the Add button. Now for this file to be a mutation file, we need to enhance from the base class ObjectGraphType. So in here, enhance from the ObjectGraphType. Now let us just remove the extra S from here and then import the namespace. That is going to be the…

Contents