public ActionResult Create(Emprestimo emprestimo) { if (ModelState.IsValid) { emprestimo.CadastrarEmprestimo(emprestimo); return(RedirectToAction("Index")); } @ViewBag.Clientes = RetornaSelectListItem.Clientes(); @ViewBag.Livros = RetornaSelectListItem.LivrosNaoEmprestados(); return(View(emprestimo)); }
public ActionResult Create([Bind(Include = "id,dataAluguel,dataPrevistaDevolucao,clienteId, livroId")] Emprestimo emprestimo) { emprestimo = Valida.DataInicialDataFinal(emprestimo); if (ModelState.IsValid) { emprestimo.CadastrarEmprestimo(emprestimo); return(RedirectToAction("Index")); } @ViewBag.Livros = RetornaSelectListItem.LivrosNaoEmprestados(); @ViewBag.Clientes = RetornaSelectListItem.Clientes(); return(View(emprestimo)); }