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"); }
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>"); } }
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" })); }
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"); }
public void Add(Roles role) { rolesService.Add(role); }
public async Task <ActionResult <string> > Add(AddRoleInputDto model) { var roleId = await rolesService.Add(model); return(CreatedAtAction(nameof(Get), new { id = roleId }, new { id = roleId })); }