Пример #1
0
        /*********************************/
        /*                               */
        /* Database Manipulation Methods */
        /*                               */
        /*********************************/

        /* Get the NameRoot ID */
        public int GetNameRootID()
        {
            int rootID = -1;
            var result = from n in db2.NameRoots select n;

            if (result.Count() > 0)
            {
                NameRoot link = result.FirstOrDefault();
                rootID = link.RootID;
            }
            return(rootID);
        }
Пример #2
0
        /* Set the NameRoot to given ID */
        public void SetNameRootID(int ID)
        {
            var result = from n in db2.NameRoots select n;

            if (result.Count() > 0)
            {
                NameRoot link = result.FirstOrDefault();
                link.RootID = ID;
                db2.SaveChanges();
            }
            else
            {
                NameRoot link = new NameRoot();
                link.RootID = ID;
                db2.NameRoots.Add(link);
                db2.SaveChanges();
            }
        }