Beispiel #1
0
        /// <summary>
        /// EMailAddress
        /// </summary>
        //private Simplified.Ring3.EmailAddress EMailAddress {
        //    get {
        //        Simplified.Ring3.SystemUser user = this.Data as Simplified.Ring3.SystemUser;
        //        if (user == null) return null;
        //        return Db.SQL<Simplified.Ring3.EmailAddress>("SELECT o FROM Simplified.Ring3.EmailAddress o WHERE o.ToWhat=?", user).First;
        //    }
        //}

        #region View-model Handlers

        /// <summary>
        /// Delete user
        /// </summary>
        /// <param name="action"></param>
        void Handle(Input.Delete action)
        {
            this.Message = null;
            var        transaction = this.Transaction;
            SystemUser user        = this.Data;
            SystemUser systemUser  = Helper.GetCurrentSystemUser();

            if (systemUser.Equals(user))
            {
                // TODO: Show error message "Can not delete yourself"
                return;
            }

            this.Data = null;
            // TODO: Warn user with Yes/No dialog
            transaction.Rollback();

            transaction.Scope(() =>
            {
                SystemUserAdmin.DeleteSystemUser(user);
            });

            transaction.Commit();

            this.RedirectUrl = "/UserAdmin/admin/users";
        }
Beispiel #2
0
        void Handle(Input.Delete action)
        {
            SystemUser systemUser = Helper.GetCurrentSystemUser();

            if (systemUser.Equals(this.Data))
            {
                // TODO: Show error message "Can not delete yourself"
                return;
            }

            // TODO: Warning user with Yes/No dialog
            Db.Transact(() => {
                SystemUserAdmin.DeleteSystemUser(this.Data as Simplified.Ring3.SystemUser);
            });
        }