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 trialJohn Lundberg
20,368 PointsWhat am i doing wrong here? Building services with ASP.NET Web API
In the second section and the in the "Adding an API Controller" quiz, my test will not pass.
If i run my code with postman i will Get the collection from the controller, so my code is working but it will not accept the zip file... and when i run the test in the gulpfile i get the following error message: S2CC3Tests.cs(11,20): error CS0234: The type or namespace name 'Controllers' does not exist in the namespace 'IssueTracker' (are you missing an assembly reference?) [C:\Users\JohnLundberg(Svemo)\Desktop\lcc-dotnet-aspnet-web-api-s2cc3\src\IssueTrackerTests\IssueTrackerTests.csproj] [16:02:01] MSBuild failed with code 1!
Here is my code for my API controller
using System.Collections.Generic;
using System.Web.Http;
using IssueTrackerShared.Models;
namespace IssueTracker.Controllers
{
public class IssuesController : ApiController
{
public IEnumerable<Issue> Get()
{
return new List<Issue>()
{
new Issue(2017, 10, 5, "Metallica", "trump@whitehouse.com", new Department() {Name = "kalle"}, "I have huge problemos", Issue.SeverityLevel.Major, false),
new Issue(2016, 09, 5, "DeaThIsNear", "trump@whitehouse.com", new Department() {Name = "kalle"}, "I have huge problemos", Issue.SeverityLevel.Major, false)
};
}
public Issue Get(int id)
{
return null;
}
public void Post()
{
}
public void Put()
{
}
public void Delete()
{
}
}
}
1 Answer
John Lundberg
20,368 PointsThe strangest thing. When i woke up this morning and tried it again, my soulution for the challange worked....