public ActionResult EditWriter(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.WriterUpdate(p); return(RedirectToAction("Index")); } else { foreach (var item in results.Errors) { ModelState.AddModelError(item.PropertyName, item.ErrorMessage); } } return(View()); }
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()); }
public ActionResult WriterProfile(Writer p) { ValidationResult results = writerValidator.Validate(p); if (Request.Files.Count > 0 || results.IsValid) { //Bu kısım writer image güncellemek için string dosyaAdi = Path.GetFileName(Request.Files[0].FileName); string uzanti = Path.GetExtension(Request.Files[0].FileName); string yol = "~/avatar/" + dosyaAdi + uzanti; Request.Files[0].SaveAs(Server.MapPath(yol)); p.WriterImage = "/avatar/" + dosyaAdi + uzanti; p.WriterStatus = true; p.WriterRole = "A"; writerManager.WriterUpdate(p); return(RedirectToAction("AllHeadings", "WriterPanel")); } else { foreach (var item in results.Errors) { ModelState.AddModelError(item.PropertyName, item.ErrorMessage); } } return(View()); }
public ActionResult EditWriter(Writer w) { ValidationResult results = writerValidator.Validate(w); if (results.IsValid) { writerManager.WriterUpdate(w); return(RedirectToAction("Index")); } else { foreach (var item in results.Errors) { ModelState.AddModelError(item.PropertyName, item.ErrorMessage); } } writerManager.WriterUpdate(w); return(View()); }
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")); }
public ActionResult EditWriter(Writer p) { ValidationResult results = writervalidator.Validate(p); if (results.IsValid) { wm.WriterUpdate(p); return(RedirectToAction("Index")); } else { foreach (var x in results.Errors) { ModelState.AddModelError(x.PropertyName, x.ErrorMessage); } } return(View()); }
public ActionResult WriterProfile(Writer p) { ValidationResult result = writervalidator.Validate(p); if (result.IsValid) { wm.WriterUpdate(p); return(RedirectToAction("AllHeading", "WriterPanel")); } else { foreach (var item in result.Errors) { ModelState.AddModelError(item.PropertyName, item.ErrorMessage); } } return(View()); }
public ActionResult EditWriter(Writer writer) { ValidationResult validationResult = validationRules.Validate(writer); if (validationResult.IsValid) { writerManager.WriterUpdate(writer); return(RedirectToAction("Index")); } else { foreach (var item in validationResult.Errors) { ModelState.AddModelError(item.PropertyName, item.ErrorMessage); } } return(View()); }
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()); }
public ActionResult EditWriter(Writer writer) { ValidationResult res = writerValidator.Validate(writer); writerManager.WriterUpdate(writer); return(RedirectToAction("Index")); //if (res.IsValid) //{ //} //else //{ // foreach (var item in res.Errors) // { // ModelState.AddModelError(item.PropertyName, item.ErrorMessage); // } //} // return View(); }
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()); }
public ActionResult EditWriter(Writer p) { wm.WriterUpdate(p); return(RedirectToAction("Index")); }