Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the issues as per Instructions.txt #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion TakeHome/Controllers/FeedbackController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ public class FeedbackController : Controller

public ActionResult Index()
{
return View();
return View("FeedBack");
}

public ActionResult FeedbackGoneWrong()
{
return View("FeedbackGoneWrong"); // but this view does not exist, so it should show error page
}

[ValidateInput(true)]
[HttpPost]
public ActionResult Feedback(FeedbackForm form)
{
if (ModelState.IsValid)
Expand Down
10 changes: 5 additions & 5 deletions TakeHome/Instructions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Requirements:

The following bugs have been reported with this feature

The error page is not showing.
Our Contact page is missing from the main header.
The new Feedback Form page will not load
Submitting the form does not work.
The thank you page should display the form responses you submitted but does not.
The error page is not showing. - <customErrors defaultRedirect="Error" mode="On" redirectMode="ResponseRewrite">
Our Contact page is missing from the main header. - <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
The new Feedback Form page will not load - return View("FeedBack");
Submitting the form does not work. - [HttpPost]
The thank you page should display the form responses you submitted but does not. - @model TakeHome.Models.FeedbackForm
2 changes: 1 addition & 1 deletion TakeHome/Models/FeedbackForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public String LastName
get;
set;
}
[Required(AllowEmptyStrings = false, ErrorMessage = "Please Provide Eamil")]
[Required(AllowEmptyStrings = false, ErrorMessage = "Please Provide Email")]
[RegularExpression("^[a-zA-Z0-9_\\.-]+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$", ErrorMessage = "Please Provide Valid Email")]
[StringLength(200, MinimumLength = 0, ErrorMessage = "First Name Should be min 1 and max 25 length")]
public String Email
Expand Down
4 changes: 2 additions & 2 deletions TakeHome/TakeHome.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<AssemblyName>TakeHome</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<UseIISExpress>false</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
Expand Down Expand Up @@ -221,7 +221,7 @@
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>3786</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:3786/</IISUrl>
<IISUrl>http://localhost/TakeHome</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
Expand Down
2 changes: 1 addition & 1 deletion TakeHome/Views/Feedback/Feedback.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<div class="form">
@*@using (Html.BeginForm("Submit", "Feedback"))*@
@using (Html.BeginForm())
@using (Html.BeginForm("Feedback", "FeedBack", FormMethod.Post))
{
/* form here */
<fieldset>
Expand Down
2 changes: 1 addition & 1 deletion TakeHome/Views/Feedback/ThankYou.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@model object
@model TakeHome.Models.FeedbackForm

@{
ViewBag.Title = "ThankYou";
Expand Down
4 changes: 3 additions & 1 deletion TakeHome/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Feedback", "Index", "Feedback")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
<li>@Html.ActionLink("Feedback", "Index", "Feedback")</li>
<li>@Html.ActionLink("Something gone wrong", "FeedbackGoneWrong", "Feedback")</li>
</ul>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion TakeHome/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<system.web>
<compilation debug="true" targetFramework="4.7"/>
<httpRuntime targetFramework="4.7"/>
<customErrors defaultRedirect="Error" mode="Off" redirectMode="ResponseRewrite">
<customErrors defaultRedirect="Error" mode="On" redirectMode="ResponseRewrite">
</customErrors>
</system.web>
<system.webServer>
Expand Down