Esempio n. 1
0
        public static UserSystem GetUserRealm()
        {
            var realm = Realm.GetInstance();

            UserSystem user = realm.All <UserSystem>().LastOrDefault();

            return(user);
        }
Esempio n. 2
0
        public static void SaveUserRealm(UserSystem usuario)
        {
            var realm = Realm.GetInstance();

            realm.Write(() =>
            {
                realm.Add(usuario);
            });
        }
Esempio n. 3
0
        public static void UpdateUserRealm(UserSystem usuario)
        {
            var realm = Realm.GetInstance();

            UserSystem user = realm.All <UserSystem>().First(b => b.UserID == usuario.UserID);

            realm.Write(() =>
            {
                realm.Add(usuario);
            });
        }
Esempio n. 4
0
        public static void DeleteUserRealm(int id)
        {
            var realm = Realm.GetInstance();

            if (CountUserSystem() > 0)
            {
                UserSystem user = realm.All <UserSystem>().First(b => b.UserID == id);

                if (user != null)
                {
                    // Delete an object with a transaction
                    using (var trans = realm.BeginWrite())
                    {
                        realm.Remove(user);
                        trans.Commit();
                    }
                }
            }
        }