コード例 #1
0
        public ActionResult Create(FormCollection collection)
        {
            try {
                Disciplina disciplina = new Disciplina();
                disciplina.Descricao = collection["Descricao"];
                DisciplinaDAO.Persistir(disciplina);

                return(RedirectToAction("Index"));
            }
            catch {
                return(View());
            }
        }
コード例 #2
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try {
                Disciplina disciplina = new Disciplina();
                disciplina.Id        = id;
                disciplina.Descricao = collection["Descricao"];

                if (!DisciplinaDAO.Persistir(disciplina))
                {
                    return(View());
                }
                return(RedirectToAction("Index"));
            }
            catch {
                return(View());
            }
        }