Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C#

Marina Gulakova
Marina Gulakova
3,145 Points

The Issue model does not have such properties: Date, ActivityId, Duration, Intensity, Exclude, Notes.

The Issue model does not have such properties: Date, ActivityId, Duration, Intensity, Exclude, Notes. Those are the properties from Activity model instead.

1 Answer

James Churchill
STAFF
James Churchill
Treehouse Teacher

Marina,

Oh no! Sorry for the mistake. Here are the correct detailed instructions for the code challenge:

Set up the DTO...
* Add a folder to the root of the "IssueTracker" project named "Dto"
* Add a class to the "Dto" folder named `IssueDto`
* Add properties to the `IssueDto` class using the `Issue` model class as a guide
  * A property of type `int` named `Id`
  * A property of type `DateTime?` named `ReportedOn`
  * A property of type `string` named `Name`
  * A property of type `string` named `Email`
  * A property of type `int?` named `DepartmentId`
  * A property of type `string` named `DescriptionOfProblem`
  * A property of type `Issue.SeverityLevel?` named `Severity`
  * A property of type `bool` named `Reproducible`
* Add `Required` data annotation attributes to the appropriate properties
  * `ReportedOn`
  * `Name`
  * `Email`
  * `DepartmentId`
  * `DescriptionOfProblem`
  * `Severity`
* Add a `MaxLength` data annotation attribute to the `Name` property in order to restrict the length of the value to 100 characters
* Add a `MaxLength` data annotation attribute to the `Email` property in order to restrict the length of the value to 255 characters
* Add a method named `ToModel` that converts the DTO to an instance of the `Issue` model class

Update the IssueController...

Update the `Post` action method to use the DTO...
* Update the `issue` parameter's type to `IssueDto`
* Call the DTO's `ToModel` method to get an instance of a model to pass to the repository's `Add` method
* Set the DTO's `Id` property with the model's `Id` property value after calling the IssueRepository's `Add` method
  * This is necessary to do in order to update the DTO with the ID value that was generated from the database before the DTO is returned to the client

Update the `Put` action method...
* Update the return type to `IHttpActionResult`
* Return a call to the `BadRequest` method if the `ModelState.IsValid` property is false
* Return a call to the `StatusCode` method passing in the `HttpStatusCode.NoContent` enum value
* Update the `issue` parameter's type to `IssueDto`
* Call the DTO's `ToModel` method to get an instance of a model to pass to the IssuesRepository's `Update` method

I'll work on getting the code challenge updated in the course. Thanks for catching and reporting this issue!

Thanks ~James

James Churchill
James Churchill
Treehouse Teacher

Okay... the code challenge has been updated too. The only thing that changed in the project files download was the README file in the root folder. Just download the project files again to get an updated version of the README file.