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 trialAmy Shah
25,337 PointsI made an attempt here but I think I have to do something different
Did I do the right thing by adding another method
using System.Web.Mvc;
namespace IssueReporter.Controllers
{
public class IssuesController : Controller
{
public ActionResult Report()
{
return View();
}
public ActionResult Add(string name, string email, string departmentid, string severity, string reproducible, string descriptionOfProblem)
{
return View();
}
}
}
@{
ViewBag.Title = "Report an Issue";
}
<h2>@ViewBag.Title</h2>
<form method="post">
<div>
<label for="Name">Name</label>
<input type="text" id="Name" name="Name" />
</div>
<div>
<label for="Email">Email</label>
<input type="text" id="Email" name="Email" />
</div>
<div>
<label for="DepartmentId">Department</label>
<input type="text" id="DepartmentId" name="DepartmentId" />
</div>
<div>
<label for="Severity">Severity</label>
<input type="text" id="Severity" name="Severity" />
</div>
<div>
<label for="Reproducible">Reproducible</label>
<input type="text" id="Reproducible" name="Reproducible" />
</div>
<div>
<label for="DescriptionOfProblem">Description of Problem</label>
<textarea id="DescriptionOfProblem" name="DescriptionOfProblem"></textarea>
</div>
<button type="submit">Save</button>
</form>
1 Answer
James Churchill
Treehouse TeacherAmy,
Let's use the code challenge's instructions as a check list.
1) Decorate the action method with an attribute so that MVC will only route POST requests to it.
2) Add a total of six parameters that match the form field names in the Report.cshtml view file in order to capture posted values from the form. Remember to change the first letter of each form field to lowercase (i.e. "Name" to "name").
3) Use the string data type for each parameter.
4) For now, in the action method, just return a call to the View method.
So, it looks like you've completed items #3 and #4. Item #2 looks close to being done, but you should double check your parameter names (remember, C# is case sensitive). And it looks like you still need to complete item #1.
Thanks ~James