예제 #1
0
        protected void btnSubmit_OnClick(object sender, EventArgs e)
        {
            var res = rolesSvc.Add(new Model.Roles()
            {
                Roles_Title = txtName.Text.Trim()
            });
            //if (res > 0)
            //{
            //    Response.Write("<script>alert('新增成功');location.href='Roles_List.aspx'</script>");
            //}
            //else
            //{
            //    Response.Write("<script>alert('新增失败');'</script>");
            //}

            ReturnMsg rm = res > 0
                  ? new ReturnMsg()
            {
                Code    = StatusCode.Ok,
                Message = "新增权限成功",
                Data    = null
            }
                  : new ReturnMsg()
            {
                Code    = StatusCode.Error,
                Message = "新增权限失败",
                Data    = null
            };

            Session["Msg"] = rm; //用于传递执行信息的
            Response.Redirect("Roles_List.aspx");
        }
예제 #2
0
        public ActionResult Create(Roles roles)
        {
            if (ModelState.IsValid)
            {
                service.Add(roles);
                return(RedirectToAction("Index"));
            }

            return(View(roles));
        }
        /// <summary>
        /// 保存按钮的点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSumbit_OnClick(object sender, EventArgs e)
        {
            var title = this.RolesTitle.Text.Trim();
            int rs    = bll.Add(new Model.Roles()
            {
                Title = title
            });

            if (rs > 0)
            {
                //添加成功
                Response.Write("<script>alert('添加成功');location.href='RolesList.aspx'</script>");
            }
            else
            {
                //添加失败
                Response.Write("<script>alert('添加失败');</script>");
            }
        }
예제 #4
0
        public async Task <IActionResult> OnPostSubmit()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var result = await RolesService.Add(new ReturnResult <RoleViewModel>() { Value = Input });

            ModelState.Merge(result);

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            ShowMessage(CoreEnumerations.MessageTypes.info, SharedResources.CreateSuccess);

            return(RedirectToPage("/Roles/Index", new { area = "UserManagementAdmin" }));
        }
예제 #5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var res = rs.Add(new Model.Roles()
            {
                Roles_Title = txtName.Text.Trim()
            });
            ReturnMsg rm = res > 0 ? new ReturnMsg
            {
                Code    = StatusCode.Ok,
                Message = "新增权限成功",
                Data    = null
            } : new ReturnMsg
            {
                Code    = StatusCode.Error,
                Message = "新增权限失败",
                Data    = null
            };

            Session["Msg"] = rm;
            Response.Redirect("Roles_list.aspx");
        }
예제 #6
0
 public void Add(Roles role)
 {
     rolesService.Add(role);
 }
예제 #7
0
        public async Task <ActionResult <string> > Add(AddRoleInputDto model)
        {
            var roleId = await rolesService.Add(model);

            return(CreatedAtAction(nameof(Get), new { id = roleId }, new { id = roleId }));
        }