Example #1
0
        /// <summary>
        ///
        /// </summary>
        public void Edit()
        {
            var db = new MonitoringDB();

            db.Users.Attach(this);
            db.Entry(this).State = EntityState.Modified;
            db.SaveChanges();
        }
Example #2
0
        /// <summary>
        /// NotImplementedException
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static bool Delete(int id)
        {
            throw new NotImplementedException();

            var        db           = new MonitoringDB();
            UsersGroup currentGroup = db.UserGroups.Where(x => x.UsersGroupId == id).First();

            if (currentGroup == null)
            {
                return(false);
            }

            /*
             * var fullEntries = dbContext.tbl_EntryPoint
             * .Join(
             * dbContext.tbl_Entry,
             * entryPoint => entryPoint.EID,
             * entry => entry.EID,
             * (entryPoint, entry) => new { entryPoint, entry }
             * )
             *
             *
             * //try
             * //{
             * if (db.Users.Join(db.UserGroups,
             * entryPoint => entryPoint.Group,
             * entry => entry.UsersGroupId,
             * (entryPoint, entry) => new { entryPoint, entry }))
             * //.Count() > 0)
             * {
             *  foreach (var item in db.Users.Where(x=>x.Group==currentGroup))
             *  {
             *      db.Users.Remove(item);
             *  }
             *  db.SaveChanges();
             * }
             * else
             * {*/

            db.UserGroups.Remove(db.UserGroups.Where(x => x.UsersGroupId == id).First());
            //}
            db.SaveChanges();
            return(true);

            /* }
             * catch (Exception err)
             * {
             *   Debug.WriteLine(err.Message);
             *   return false;
             * }*/
        }