예제 #1
0
        public ActionResult Index(tbl_Notes model, string clientCaptcha)
        {
            string serverCaptcha = Session["CAPTCHA"].ToString();

            if (!clientCaptcha.Equals(serverCaptcha))
            {
                ViewBag.ShowCAPTCHA = serverCaptcha;

                ViewBag.CaptchaError = "Wrong captcha !!!";
                Session["CAPTCHA"]   = GetRandomText();
                return(View(model));
            }
            model.ID = Guid.NewGuid();
            //model.Content = model.Content.Replace(Environment.NewLine, "<br/>");
            if (dao.AddNote(model))
            {
                return(RedirectToAction("Index", new { id = model.ID }));
            }
            else
            {
                return(View());
            }
        }