Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. // Código do método post de inserir a informação no bd
  2.  
  3. [HttpPost]
  4. [ActionName("Create")]
  5. public ActionResult Create_POST(Produto produto, int Id)
  6. {
  7. if (ModelState.IsValid)
  8. {
  9. ProdutoBLL produtoBll = new ProdutoBLL();
  10. produto.Id = produtoBll.PesquisaId(produto);
  11. Session["IdProduto"] = produto.Id;
  12. return RedirectToAction("Catalogo", "Material", new { produto = produto.Id });
  13. }
  14. return View();
  15. }
  16.  
  17. // Código do método GET que utiliza o Id que acabou de ser criado.
  18.  
  19. [HttpGet]
  20. [Authorize(Roles = "Gerente,Funcionario")]
  21. [ActionName("Catalogo")]
  22. public ActionResult Catalogo(int produto, int? pag, int? mats)
  23. {
  24. material.produto = produto;
  25. return View(materialBll.BuscaMaterial().ToPagedList(pag ?? 1, 3));
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement