Ejemplo n.º 1
0
 public static AjaxResult ChangePass(string token, string pass)
 {
     return(MvcHelp.Try(() =>
     {
         //var fo = Db.First<User>(a => a.name == "admin");
         Db.Update <User>(a => a.name == "admin", Mongo.GetUpdateDef <User>().Set(b => b.pass, pass));
     }));
 }
Ejemplo n.º 2
0
        public static AjaxResult SetContent(string token, string type, string content)
        {
            return(MvcHelp.Try(() =>
            {
                var bd = Mongo.GetUpdateDef <Content>();

                var dd = bd.Set <string>(b => b.content, content);
                var cc = bd.Set <DateTime>(b => b.editTime, DateTime.Now);
                var fo = Db.First <Content>(a => a.type == type);
                if (fo == null)
                {
                    Db.Insert <Content>(new Content {
                        type = type, content = content, editTime = DateTime.Now
                    });
                }
                Db.Update <Content>(a => a.type == type, bd.Combine(cc, dd));
            }));
        }