> For the complete documentation index, see [llms.txt](https://eleven-fifty-academy.gitbook.io/dotnet-201-elevennote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eleven-fifty-academy.gitbook.io/dotnet-201-elevennote/elevennote-parts-1-11/part-5-notecreate/5.1-notecreatemodel.md).

# 5.1: NoteCreate Model

In this section, we'll create the `NoteCreate` model that allow us to have some validation for the note properties.

## Purpose

Think about the things we'll need to capture when we create a note and save it to the database. We need to create a Title, Content, and DateCreated. Will we provide an id though?

The answer is no. The id will be created after the POST request happens, after we fill out a form with the two properties above. So, we won't provide that. Our .Service and .Data layer will work together to take care of that. Let's talk about that again soon.

## NoteCreate model

1. Right click on **ElevenNote.Models**
2. Select **Add -> Class** and name it `NoteCreate.cs`
3. Make the class public.
4. Add the following properties (for the `ToString` method, you can type `override` and then a space):

```csharp
namespace ElevenNote.Models
{
    public class NoteCreate
    {
        public string Title { get; set; }
        public string Content { get; set; }

        public override string ToString()
        {
            return base.ToString();
        }
    }
}
```

1. Add the `[Required]` annotation to the `Title` property:

   ```csharp
            [Required]
            public string Title { get; set; }
            public string Content { get; set; }
   ```
2. `CTRL .` to bring in the using statement
3. We can also add annotations to require or limit the number of characters in each field.

   ```csharp
            [Required]
            [MinLength(2, ErrorMessage = "Please enter at least 2 characters.")]
            [MaxLength(100, ErrorMessage = "There are too many characters in this field.")]
            public string Title { get; set; }

            [MaxLength(8000)]
            public string Content { get; set; }
   ```
4. [Next,](/dotnet-201-elevennote/elevennote-parts-1-11/part-5-notecreate/5.2-createview.md) we'll make the view for creating a note.
