Ejemplo n.º 1
0
        public ActionResult AddWriter(Writer p, HttpPostedFileBase file)
        {
            if (file != null)
            {
                var    dosya_formati_adi = Path.GetFileName(file.FileName);
                string dosya_adi         = Guid.NewGuid().ToString() + dosya_formati_adi;
                p.WriterImage = dosya_adi;
                file.SaveAs(Server.MapPath("/AdminLTE-3.0.4/dist/img/" + dosya_adi));
            }

            ValidationResult results = writerValidator.Validate(p);

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

            if (results.IsValid)
            {
                writerManager.WriterAdd(writer);
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var i in results.Errors)
                {
                    ModelState.AddModelError(i.PropertyName, i.ErrorMessage);
                }
            }
            return(View());
        }
Ejemplo n.º 4
0
        public ActionResult AddWriter(Writer p)
        {
            ValidationResult results = writervalidator.Validate(p);

            if (results.IsValid)
            {
                wm.WriterAdd(p);
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var x in results.Errors)
                {
                    ModelState.AddModelError(x.PropertyName, x.ErrorMessage);
                }
            }
            return(View());
        }
Ejemplo n.º 5
0
        public ActionResult AddWriter(Writer writer)
        {
            ValidationResult validationResult = validationRules.Validate(writer);

            if (validationResult.IsValid)
            {
                writerManager.WriterAdd(writer);
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in validationResult.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }
            return(View());
        }
Ejemplo n.º 6
0
        public ActionResult AddWriter(Writer writer)
        {
            WriterValidator  wV      = new WriterValidator();
            ValidationResult results = wV.Validate(writer);

            if (results.IsValid)
            {
                wM.WriterAdd(writer);
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in results.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }
            return(View());
        }
Ejemplo n.º 7
0
        public ActionResult AddWriter(Writer writer)
        {
            ValidationResult results = writerValidator.Validate(writer);

            if (results.IsValid)
            {
                writer.WriterImage = "https://dosya.wmaraci.com/nedir/admin.png";
                writerManager.WriterAdd(writer);
                return(RedirectToAction("Index"));
            }
            else
            {
                foreach (var item in results.Errors)
                {
                    ModelState.AddModelError(item.PropertyName, item.ErrorMessage);
                }
            }
            return(View());
        }