Exemplo n.º 1
0
        public ActionResult AddTalent(Talent talent)
        {
            ValidationResult validationResult = talentValidator.Validate(talent);

            if (validationResult.IsValid)
            {
                talentManager.Add(talent);
                return(RedirectToAction("TalentList"));
            }
            else
            {
                foreach (var item in validationResult.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }
            return(View(talent));
        }