mirror of https://github.com/abpframework/abp.git
7 changed files with 120 additions and 25 deletions
@ -0,0 +1,32 @@ |
|||
@page |
|||
@using Microsoft.Extensions.Localization |
|||
@using Volo.Abp.Identity.Web.Localization.Resources.AbpIdentity |
|||
@model Volo.Abp.Identity.Web.Pages.Identity.Roles.CreateModalModel |
|||
@inject IStringLocalizer<IdentityResource> L |
|||
@{ |
|||
Layout = null; |
|||
} |
|||
|
|||
<form method="post" asp-page="/Identity/Roles/CreateModal"> |
|||
|
|||
<abp-modal> |
|||
|
|||
<abp-modal-header title="@L["NewRole"]"></abp-modal-header> |
|||
|
|||
<abp-modal-body> |
|||
|
|||
<div class="form-group"> |
|||
<label asp-for="RoleModel.Name"></label> |
|||
<input asp-for="RoleModel.Name" class="form-control"/> |
|||
<span asp-validation-for="RoleModel.Name" class="text-danger"></span> |
|||
</div> |
|||
|
|||
<div asp-validation-summary="All" class="text-danger"></div> |
|||
|
|||
</abp-modal-body> |
|||
|
|||
<abp-modal-footer></abp-modal-footer> |
|||
|
|||
</abp-modal> |
|||
|
|||
</form> |
|||
@ -0,0 +1,30 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.RazorPages; |
|||
|
|||
namespace Volo.Abp.Identity.Web.Pages.Identity.Roles |
|||
{ |
|||
public class CreateModalModel : AbpPageModel |
|||
{ |
|||
[BindProperty] |
|||
public CreateRoleInfoModel RoleModel { get; set; } |
|||
|
|||
private readonly IIdentityRoleAppService _identityRoleAppService; |
|||
|
|||
public CreateModalModel(IIdentityRoleAppService identityRoleAppService) |
|||
{ |
|||
_identityRoleAppService = identityRoleAppService; |
|||
RoleModel = new CreateRoleInfoModel(); |
|||
} |
|||
|
|||
public async Task<IActionResult> OnPostAsync() |
|||
{ |
|||
ValidateModel(); |
|||
|
|||
var input = ObjectMapper.Map<CreateRoleInfoModel, IdentityRoleCreateDto>(RoleModel); |
|||
await _identityRoleAppService.CreateAsync(input); |
|||
|
|||
return NoContent(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace Volo.Abp.Identity.Web.Pages.Identity.Roles |
|||
{ |
|||
public class CreateRoleInfoModel |
|||
{ |
|||
[Required] |
|||
[StringLength(IdentityRoleConsts.MaxNameLength)] |
|||
[Display(Name = "RoleName")] |
|||
public string Name { get; set; } |
|||
} |
|||
} |
|||
Loading…
Reference in new issue