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

            if (results.IsValid)
            {
                wm.WriterUpdate(p);



                ViewBag.result = "Güncellendi.";



                return(View("WriterProfile", p));
            }

            else
            {
                foreach (var item in results.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }

            return(View());
        }
コード例 #2
0
        public ActionResult WriterProfile(Writer writer)
        {
            WriterValidator  writerValidator = new WriterValidator();
            ValidationResult results         = writerValidator.Validate(writer);

            if (results.IsValid)
            {
                writerManager.WriterUpdate(writer);
                return(RedirectToAction("AllHeading", "WriterPanel"));
            }
            foreach (var item in results.Errors)
            {
                ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
            }
            return(RedirectToAction("AllHeading", "WriterPanel"));
        }
コード例 #3
0
        public ActionResult AddWriter(Writer writer)
        {
            WriterValidator  writerValidator = new WriterValidator();
            ValidationResult result          = writerValidator.Validate(writer);

            if (result.IsValid)
            {
                wm.SetWriter(writer);
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in result.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }
            return(View());
        }
コード例 #4
0
        public ActionResult WriterProfile(Writer w)
        {
            WriterValidator  validationRules1 = new WriterValidator();
            ValidationResult result           = validationRules1.Validate(w);

            if (result.IsValid)
            {
                wm.WriterUpdate(w);
                return(RedirectToAction("AllHeading", "WriterPanel"));
            }
            else
            {
                foreach (var item in result.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }
            return(View());
        }
コード例 #5
0
        public ActionResult WriterProfile(Writer p)
        {
            WriterValidator  writervalidator = new WriterValidator();
            ValidationResult results         = writervalidator.Validate(p);

            if (results.IsValid)
            {
                writerManager.WriterUpdate(p);
                return(RedirectToAction("WriterProfile"));
            }
            else
            {
                foreach (var item in results.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }
            return(View());
        }
コード例 #6
0
        public ActionResult AddWriter(Writer writer)
        {
            WriterValidator  writerValidator = new WriterValidator();
            ValidationResult results         = writerValidator.Validate(writer);

            if (results.IsValid)
            {
                writerManager.Add(writer);
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var result in results.Errors)
                {
                    ModelState.AddModelError(result.PropertyName, result.ErrorMessage);
                }
            }
            return(View());
        }
コード例 #7
0
        public ActionResult WriterProfile(Writer p)
        {
            WriterValidator writervalidator = new WriterValidator();

            ValidationResult results = writervalidator.Validate(p);

            if (results.IsValid)
            {
                wm.WriterUpdate(p);
                return(RedirectToAction("AllHeading", "WriterPanel"));
            }
            else
            {
                foreach (var x in results.Errors)
                {
                    ModelState.AddModelError(x.PropertyName, x.ErrorMessage);
                }
            }
            return(View());
        }
コード例 #8
0
        public ActionResult WriterProfile(Writer p)
        {
            WriterValidator  writerValidation = new WriterValidator();
            ValidationResult results          = writerValidation.Validate(p);

            if (results.IsValid)
            {
                p.WriterStatus = true;
                p.WriterRole   = "A";
                wm.WriterUpdate(p);
                return(RedirectToAction("AllHeading", "WriterPanel"));
            }
            else
            {
                foreach (var item in results.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }
            return(View());
        }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JSchemaValidatingWriter"/> class that
 /// validates the content that will be written to the given <see cref="JsonWriter"/>.
 /// </summary>
 /// <param name="writer">The <see cref="JsonWriter"/> to write to while validating.</param>
 public JSchemaValidatingWriter(JsonWriter writer)
 {
     ValidationUtils.ArgumentNotNull(writer, "writer");
     _writer = writer;
     _validator = new WriterValidator(this);
 }
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JSchemaValidatingWriter"/> class that
 /// validates the content that will be written to the given <see cref="JsonWriter"/>.
 /// </summary>
 /// <param name="writer">The <see cref="JsonWriter"/> to write to while validating.</param>
 public JSchemaValidatingWriter(JsonWriter writer)
 {
     ValidationUtils.ArgumentNotNull(writer, nameof(writer));
     _writer    = writer;
     _validator = new WriterValidator(this);
 }