Exemple #1
0
 public ActionResult PowerEdits(info_Role role)
 {
     if (irb.Update(role) > 0)
     {
         return(Content("<script>alert('修改成功');window.location.href='/Systems/PowerSelect'</script>"));
     }
     else
     {
         return(Content("<script>alert('修改失败');window.location.href='/Systems/PowerSelect'</script>"));
     }
 }
        protected override void Simpan()
        {
            if (_isNewData)
            {
                _role = new Role();
            }

            _role.nama_role = txtNamaRole.Text;
            _role.is_active = rdoAktif.Checked;

            var result          = 0;
            var validationError = new ValidationError();

            if (_isNewData)
            {
                result = _bll.Save(_role, ref validationError);
            }
            else
            {
                result = _bll.Update(_role, ref validationError);
            }

            if (result > 0)
            {
                Listener.Ok(this, _isNewData, _role);

                if (_isNewData)
                {
                    base.ResetForm(this);
                    txtNamaRole.Focus();
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                if (validationError.Message != null && validationError.Message.Length > 0)
                {
                    MsgHelper.MsgWarning(validationError.Message);
                    base.SetFocusObject(validationError.PropertyName, this);
                }
                else
                {
                    MsgHelper.MsgUpdateError();
                }
            }
        }
Exemple #3
0
        public void UpdateTest()
        {
            var obj = new Role
            {
                role_id   = "42d0a7b9-2b1a-4ad7-b6ad-b7c8b65ef04a",
                nama_role = "Kasir",
                is_active = true
            };

            var validationError = new ValidationError();

            var result = _bll.Update(obj, ref validationError);

            Console.WriteLine("Error : " + validationError.Message);

            Assert.IsTrue(result != 0);

            var updatedObj = _bll.GetByID(obj.role_id);

            Assert.IsNotNull(updatedObj);
            Assert.AreEqual(obj.role_id, updatedObj.role_id);
            Assert.AreEqual(obj.nama_role, updatedObj.nama_role);
            Assert.AreEqual(obj.is_active, updatedObj.is_active);
        }
 public IActionResult Edit(RoleViewModel formData)
 {
     return(Ok(_role.Update(formData)));
 }