コード例 #1
0
        public ActionResult AddWriter(Writer p)
        {
            ValidationResult results = writerValidator.Validate(p);

            if (results.IsValid)
            {
                wm.WriterAddBl(p);
                return(RedirectToAction("WritersList"));
            }
            else
            {
                foreach (var item in results.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }

            return(View());
        }