Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ActionResult Adiciona(AbastecimentoModel viewModel)
- {
- viewModel.TotalGasto = viewModel.Litro * viewModel.VlrUnit;
- if (ModelState.IsValid)
- {
- Abastecimento abastecimento = viewModel.CriaAbastecimento();
- dao.Adiciona(abastecimento);
- //return View();
- return RedirectToAction("Index");
- }
- else
- {
- ViewBag.Usuarios = usuarioDAO.Lista();
- ViewBag.Veiculo = veiculoDAO.Lista();
- return View("Form",viewModel);
- }
- }
- @model IList<BlogWeb.Models.Abastecimento>
- <!DOCTYPE HTML>
- <p>@Html.ActionLink("Novo Abastecimento", "Form")</p>
- <table class="table table-hover">
- <thead>
- <tr>
- <th>NΒΊ do Carro</th>
- <th>Data</th>
- <th>Litro</th>
- <th>Valor Unitario</th>
- <th>Valor Total</th>
- <th>Usuario</th>
- </tr>
- </thead>
- <tbody>
- @foreach (var a in Model)
- {
- <tr>
- <td>@a.NumCarro.NCarro</td>
- <td>@a.DtAbastecido</td>
- <td>@a.Litro</td>
- <td>@a.VlrUnit</td>
- <td>@a.TotalGasto</td>
- <td>@a.Autor.Nome</td>
- </tr>
- }
- </tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement