コード例 #1
0
        public void Update(int id, string?name)
        {
            DataConnection.DefaultSettings = new MySettings(_test);

            using var db = new DbDoctor();
            var role = Get(id);

            if (name != null)
            {
                role.Name = name;
            }

            db.Update(role);
        }
コード例 #2
0
        public void Update(int id, string?password = null, int?roleId = null)
        {
            DataConnection.DefaultSettings = new MySettings(_test);

            using var db = new DbDoctor();
            var user = Get(id);

            if (password != null)
            {
                user.Password = RSAEncryption.Encrypt(password);
            }

            if (roleId != null)
            {
                user.RoleId = (int)roleId;
            }

            db.Update(user);
        }