Ejemplo n.º 1
0
        public string diarydelete([FromBody] JObject obj)
        {
            var diarypagenum = new { pagenum = Convert.ToInt32(obj["pagenum"]) };

            using (DiaryDBEntitiesOne diarydb = new DiaryDBEntitiesOne())
            {
                Diaryinfo_tb diarycount = diarydb.Diaryinfo_tb.Where(diary => diary.DiaryinfoID == diarypagenum.pagenum).FirstOrDefault();
                diarydb.Diaryinfo_tb.Remove(diarycount);
                return(diarydb.SaveChanges() > 0?"Yes": "No");
            }
        }
Ejemplo n.º 2
0
        public string vipover([FromBody] JObject obj)
        {
            var vipinfo = new { userid = Convert.ToInt32(obj["userid"]) };

            using (DiaryDBEntitiesOne ohlifedb = new DiaryDBEntitiesOne())
            {
                User_tb userinfo = ohlifedb.User_tb.Where(info => info.User_tbID == vipinfo.userid).FirstOrDefault();
                userinfo.Memberstate = false;
                return(ohlifedb.SaveChanges() > 0 ? "Yes" : "No");
            }
        }
Ejemplo n.º 3
0
        public string newpwd([FromBody] JObject obj)
        {
            var userobj = new { userid = Convert.ToInt32(obj["userid"]), pwd = obj["pwd"].ToString() };

            using (DiaryDBEntitiesOne diarydb = new DiaryDBEntitiesOne())
            {
                User_tb userinfo = diarydb.User_tb.Where(a => a.User_tbID == userobj.userid).FirstOrDefault();
                userinfo.Passwordr = userobj.pwd;
                return(diarydb.SaveChanges() > 0 ? "Yes" : "No");
            }
        }
Ejemplo n.º 4
0
        public string tovip([FromBody] JObject obj)
        {
            var vipinfo = new { begintime = obj["begintime"], overtime = obj["overtimes"], userid = Convert.ToInt32(obj["userid"]) };

            using (DiaryDBEntitiesOne ohlifedb = new DiaryDBEntitiesOne())
            {
                User_tb userinfo = ohlifedb.User_tb.Where(info => info.User_tbID == vipinfo.userid).FirstOrDefault();
                userinfo.Memberstate = true;
                // var ss = Convert.ToDateTime(vipinfo.begintime);
                // var dd= Convert.ToDateTime(vipinfo.overtime);
                userinfo.Memberopen = Convert.ToDateTime(vipinfo.begintime);
                userinfo.Memberover = Convert.ToDateTime(vipinfo.overtime);
                return(ohlifedb.SaveChanges() > 0 ? "Yes" : "No");
            }
        }
        public string diaryinsert([FromBody] JObject obj)
        {
            var diaryinfo = new { userid = obj["userid"], diarytype = obj["diarytype"], diarycontent = obj["diarycontent"], diarymedia = obj["diarymedia"] };

            using (DiaryDBEntitiesOne diarydb = new DiaryDBEntitiesOne())
            {
                var Diaryinfo = new Diaryinfo_tb();
                Diaryinfo.User_tbID    = (int)diaryinfo.userid;
                Diaryinfo.Diarytype    = (int)diaryinfo.diarytype;
                Diaryinfo.Diarycontent = (string)diaryinfo.diarycontent;
                Diaryinfo.Diarymedia   = (string)diaryinfo.diarymedia;
                Diaryinfo.Diarytime    = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                diarydb.Diaryinfo_tb.Add(Diaryinfo);
                return(diarydb.SaveChanges() > 0 ? "Yes" : "No");
            }
        }
Ejemplo n.º 6
0
        public string newuser([FromBody] JObject obj)
        {
            var userobj = new { Accountnumber = obj["Accountnumber"], pwd = obj["pwd"].ToString() };

            using (DiaryDBEntitiesOne diarydb = new DiaryDBEntitiesOne())
            {
                User_tb userinfo = new User_tb();
                userinfo.Accountnumber = userobj.Accountnumber.ToString();
                userinfo.Passwordr     = userobj.pwd;
                userinfo.Registertime  = DateTime.Now;
                userinfo.Memberover    = DateTime.Now;
                userinfo.Memberstate   = false;
                userinfo.Accountstate  = true;
                diarydb.User_tb.Add(userinfo);
                return(diarydb.SaveChanges() > 0 ? "Yes" : "No");
            }
        }