diff --git a/TakeHome/Controllers/FeedbackController.cs b/TakeHome/Controllers/FeedbackController.cs index f11973a..cf65635 100644 --- a/TakeHome/Controllers/FeedbackController.cs +++ b/TakeHome/Controllers/FeedbackController.cs @@ -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) diff --git a/TakeHome/Instructions.txt b/TakeHome/Instructions.txt index 7964bae..962bcf6 100644 --- a/TakeHome/Instructions.txt +++ b/TakeHome/Instructions.txt @@ -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. \ No newline at end of file +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 \ No newline at end of file diff --git a/TakeHome/Models/FeedbackForm.cs b/TakeHome/Models/FeedbackForm.cs index 504d188..9e2b660 100644 --- a/TakeHome/Models/FeedbackForm.cs +++ b/TakeHome/Models/FeedbackForm.cs @@ -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 diff --git a/TakeHome/TakeHome.csproj b/TakeHome/TakeHome.csproj index 3de13b1..09bb8df 100644 --- a/TakeHome/TakeHome.csproj +++ b/TakeHome/TakeHome.csproj @@ -16,7 +16,7 @@ <AssemblyName>TakeHome</AssemblyName> <TargetFrameworkVersion>v4.7</TargetFrameworkVersion> <MvcBuildViews>false</MvcBuildViews> - <UseIISExpress>true</UseIISExpress> + <UseIISExpress>false</UseIISExpress> <Use64BitIISExpress /> <IISExpressSSLPort /> <IISExpressAnonymousAuthentication /> @@ -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> diff --git a/TakeHome/Views/Feedback/Feedback.cshtml b/TakeHome/Views/Feedback/Feedback.cshtml index 6e2d0ec..e7448b1 100644 --- a/TakeHome/Views/Feedback/Feedback.cshtml +++ b/TakeHome/Views/Feedback/Feedback.cshtml @@ -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> diff --git a/TakeHome/Views/Feedback/ThankYou.cshtml b/TakeHome/Views/Feedback/ThankYou.cshtml index fd9b932..d01cbf7 100644 --- a/TakeHome/Views/Feedback/ThankYou.cshtml +++ b/TakeHome/Views/Feedback/ThankYou.cshtml @@ -1,4 +1,4 @@ -@model object +@model TakeHome.Models.FeedbackForm @{ ViewBag.Title = "ThankYou"; diff --git a/TakeHome/Views/Shared/_Layout.cshtml b/TakeHome/Views/Shared/_Layout.cshtml index 188c393..52c8a69 100644 --- a/TakeHome/Views/Shared/_Layout.cshtml +++ b/TakeHome/Views/Shared/_Layout.cshtml @@ -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> diff --git a/TakeHome/Web.config b/TakeHome/Web.config index 30e3a71..9174fe8 100644 --- a/TakeHome/Web.config +++ b/TakeHome/Web.config @@ -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>