Exemplo n.º 1
0
        public ActionResult Create(Faculty faculty, string facultyId)
        {
            var fvm = new FacultyViewModel();

            if (ModelState.IsValid)
            {
                try
                {
                    fvm.Faculty = _fr.CreateFaculty(faculty, facultyId);
                    if (fvm.Faculty == null)
                    {
                        throw new HttpException(404, "Faculty not found!");
                    }
                    _fr.SubmitChanges();
                    return(RedirectToAction("Index", fvm));
                }
                catch (Exception)
                {
                    throw new HttpException(404, "Unexpected error!");
                }
            }
            return(View(fvm));
        }