Пример #1
0
 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));
 }
Пример #2
0
        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));
        }