|
@model List<Modal.Postagem>
@{
ViewBag.Title = "Index";
}
<h2>
Postagens</h2>
<a href="javascript:;" id="adicionar">nova postagem</a>
<div id="criarpostagem">
@using (Html.BeginForm("NovaPostagem", "Home", FormMethod.Post))
{
<fieldset>
<legend>Criar nova postagem</legend>
<label>
Título</label><br />
@Html.TextBox("Titulo")<br />
<label>
Conteudo</label><br />
@Html.TextArea("Conteudo")<br />
<label>
Autor</label><br />
@Html.TextBox("Autor")<br />
<input type="submit" value="Cadastrar" />
</fieldset>
}
</div>
<ul>
@foreach (var postagem in Model)
{
<li><a href="@Url.Action("Visualizar", "Home", new { Id = postagem.Id })">@postagem.Titulo</a>
- criado por: @postagem.Autor.Nome em: @postagem.CriadoEm.ToLocalTime().ToString("dd/MM/yyyy HH:mm")
@Html.ActionLink("remover", "Remover", new { id = postagem.Id }, new { @class = "removerpostagem" })</li>
}
</ul>
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#criarpostagem").hide();
$("#adicionar").click(function () {
$("#criarpostagem").show();
});
$(".removerpostagem").click(function (event) {
if (confirm("Deseja realmente remover esta postagem?"))
return true;
return false;
});
});
</script>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Lazaro is a brazilian software architect, live in São Paulo, focusing on web development, NoSql and agile practices for startups.
In his personal life he is a part time runner, speaker, amateur astronomer, gamer and an absorbing knowledge ambulant.