public async Task CreateRole_Test() { // Act await _roleAppService.CreateOrUpdateAsync( new CreateOrUpdateRoleInput() { Role = new RoleEditDto() { DisplayName = "test", IsDefault = false }, GrantedPermissions = new List <string>() }); // Assert await UsingDbContextAsync(async context => { var johnNashRole = await context.Roles.FirstOrDefaultAsync(u => u.DisplayName == "test"); johnNashRole.ShouldNotBeNull(); }); }
public async Task <ActionResult> Create(GetRoleForEditOutput dto) { if (!CheckModelState(await _roleAppService.CheckErrorAsync(dto))) { await SetWeightDropdownList(dto); return(View(dto)); } await _roleAppService.CreateOrUpdateAsync(new CreateOrUpdateRoleInput() { RoleEditDto = dto.RoleEditDto }); //return Content("<script>parent.location.reload()</script>"); return(RedirectToAction("Index")); }