Ejemplo n.º 1
0
        public ActionResult AddWriter(Writer writer)
        {
            ValidationResult result = writerValidator.Validate(writer);

            if (result.IsValid)
            {
                _writerManager.AddWriter(writer);
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in result.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult AddWriter(Writer p)
        {
            ValidationResult result = validations.Validate(p);

            if (result.IsValid)
            {
                wm.AddWriter(p);
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in result.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }
            return(View());
        }