示例#1
0
        public bool ifselect(int userid, int noteid)
        {
            NoteSelect select = db.NoteSelect.Where(a => a.UserID == userid && a.NoteID == noteid).FirstOrDefault();

            if (select != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public void NoteSelect(int userid, int noteid)
        {
            NoteSelect select = db.NoteSelect.Where(b => b.UserID == userid && b.NoteID == noteid).FirstOrDefault();

            if (select != null)
            {
                db.NoteSelect.Remove(select);
                db.SaveChanges();
            }
            else
            {
                NoteSelect select1 = new NoteSelect();
                select1.NoteID = noteid;
                select1.UserID = userid;
                select1.Time   = DateTime.Now;
                db.NoteSelect.Add(select1);
                db.SaveChanges();
            }
        }