Exemplo n.º 1
0
        public ActionResult Create(Teacher teacher, HttpPostedFileBase image)
        {
            if (ModelState.IsValid)
            {
                teacher.CreateFileForContainer(image);

                _repository.CreateTeacher(teacher);
                TempData.AddMessage(MessageType.Success, string.Format(GlobalRes.TeacherCreatedMsg, teacher.FullName));
                _logger.Info("Teacher \"{0}\" created by {1}.", teacher.FullName, User.Identity.Name);

                return RedirectToAction(nameof(Table));
            } else
            {
                // there is something wrong with the data values
                return View("CreateTeacher", teacher);
            }
        }