Пример #1
0
 internal static NsEdytor UtworzTextBox(Edytor widget)
 {
     return(new NsEdytor()
     {
         Widget = widget
     });
 }
        public ActionResult EdytujTresc([Bind(Include = "Id,Tresc")] Edytor edytor)
        {
            if (ModelState.IsValid)
            {
                var userId = User.Identity.GetUserId();

                var sanitizer       = new HtmlSanitizer();
                var trescSprawdzona = sanitizer.Sanitize(edytor.Tresc);
                edytor.Tresc = trescSprawdzona;
                edytor.Id    = userId;
                try
                {
                    _repo.EdytujTresc(userId, edytor);
                    _repo.SaveChanges();
                    return(RedirectToAction("EdytujTresc", new { edytowanoDodanoInfo = 2 }));
                }
                catch
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }

            ViewBag.Warning = "Coś poszło nie tak - spróbuj ponownie";
            return(View(edytor));
        }