Пример #1
0
 public ActionResult Login(string name, string pwd, string validcode, bool record)
 {
     if (Session["ValidateCode"] == null || validcode.ToLower() != Session["ValidateCode"].ToString().ToLower())
     {
         return Json(new JsonData
         {
             Message = "验证码错误",
             Success = false
         });
     }
     JsonData _jdata = new JsonData();
     name = Server.HtmlEncode(name);
     int _code = new AuthenticationBLL().Login(name, pwd);
     if (_code == 1)
     {
         Cookie.Save("jlgl_user", name, 1);
         _jdata.Success = true;
         _jdata.Message = "登录成功!";
     }
     else
     {
         _jdata.Success = false;
         _jdata.Message = "登录失败!";
     }
     return Json(_jdata);
 }
Пример #2
0
 public ActionResult PublishAbout()
 {
     var address = Request["address"];
     var phone = Request["phone"];
     var fax = Request["fax"];
     var descript = Request["descript"];
     var content = Request["content"];
     sd_about About = new sd_about();
     if (address != null)
     {
         About.address = address.ToString();
     }
     if (phone != null)
     {
         About.phone = phone.ToString();
     }
     if (fax != null)
     {
         About.fax = fax.ToString();
     }
     if (descript != null)
     {
         About.shortDesc = descript.ToString().Replace("&lt;", "<").Replace("&gt;", ">"); ;
     }
     if (content != null)
     {
         About.content = content.ToString().Replace("&lt;", "<").Replace("&gt;", ">"); ;
     }
     About.id = Guid.NewGuid();
     JsonData data = new JsonData();
     About bll = new About();
     var model = bll.Add(About);
     data.Success = (model != null ? true : false);
     data.Message = "新闻添加成功";
     return Json(data);
 }