Created
October 7, 2011 18:15
-
-
Save cbcwebdev/1270989 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="grid_8"> | |
@using (Html.BeginForm("create", "promotion", FormMethod.Post, new { @class = "form" })) | |
{ | |
<fieldset> | |
<p> | |
@Html.LabelFor(x => x.Title) | |
@Html.TextBoxFor(x => x.Title, new { @class = "liquid" }) | |
@Html.ValidationMessageFor(x => x.Title) | |
</p> | |
<p> | |
@Html.LabelFor(x => x.Content) | |
@Html.TextAreaFor(x => x.Content, new { @class = "wysiwyg" }) | |
@Html.ValidationMessageFor(x => x.Content) | |
</p> | |
<p> | |
<button class="green" type="submit">Create Promotion</button> | |
</p> | |
</fieldset> | |
} | |
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Serializable] | |
public class CreatePromotionViewModel | |
{ | |
[Required] | |
public string Title | |
{ | |
get; | |
set; | |
} | |
[Required] | |
[AllowHtml] | |
public string Content | |
{ | |
get; | |
set; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PromotionController : Controller | |
{ | |
private readonly IEndpoint _serviceBus; | |
public PromotionController(IEndpoint serviceBus) | |
{ | |
_serviceBus = serviceBus; | |
} | |
[HttpPost] | |
public ActionResult Create(CreatePromotionViewModel viewModel) | |
{ | |
if(ModelState.IsValid) | |
{ | |
_serviceBus.Send(viewModel); | |
return RedirectToAction("create.success"); | |
} | |
return View(viewModel); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment