Merge pull request #3579 from abpframework/maliming/IActionResult

Use IActionResult as the return value of the page method in the module.
pull/3665/head
Halil İbrahim Kalkan 5 years ago committed by GitHub
commit cf44b8bfcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -42,7 +42,7 @@ namespace Volo.Abp.Account.Web.Pages
_resourceStore = resourceStore;
}
public virtual async Task OnGet()
public virtual async Task<IActionResult> OnGet()
{
var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl);
if (request == null)
@ -74,6 +74,8 @@ namespace Volo.Abp.Account.Web.Pages
{
ConsentInput.ApiScopes.Add(GetOfflineAccessScope(true));
}
return Page();
}
public virtual async Task<IActionResult> OnPost(string userDecision)

@ -24,9 +24,9 @@ namespace Volo.Abp.Account.Web.Pages.Account
return RedirectToPage("/Account/Login");
}
public virtual Task OnPostAsync()
public virtual Task<IActionResult> OnPostAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
}
}

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Volo.Abp.Identity;
using Microsoft.AspNetCore.Mvc;
namespace Volo.Abp.Account.Web.Pages.Account
{
@ -17,16 +18,18 @@ namespace Volo.Abp.Account.Web.Pages.Account
ProfileAppService = profileAppService;
}
public virtual async Task OnGetAsync()
public virtual async Task<IActionResult> OnGetAsync()
{
var user = await ProfileAppService.GetAsync();
PersonalSettingsInfoModel = ObjectMapper.Map<ProfileDto, PersonalSettingsInfoModel>(user);
return Page();
}
public virtual Task OnPostAsync()
public virtual Task<IActionResult> OnPostAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
}

@ -31,9 +31,11 @@ namespace Volo.Abp.Account.Web.Pages.Account
AccountAppService = accountAppService;
}
public virtual async Task OnGetAsync()
public virtual async Task<IActionResult> OnGetAsync()
{
await CheckSelfRegistrationAsync();
return Page();
}
public virtual async Task<IActionResult> OnPostAsync()

@ -41,9 +41,9 @@ namespace Volo.Abp.Account.Web.Pages.Account
//);
}
public virtual Task OnPostAsync()
public virtual Task<IActionResult> OnPostAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
}
}

@ -24,7 +24,7 @@ namespace Volo.Blogging.Pages.Admin.Blogs
_authorization = authorization;
}
public async Task<ActionResult> OnGetAsync()
public virtual async Task<ActionResult> OnGetAsync()
{
if (!await _authorization.IsGrantedAsync(BloggingPermissions.Blogs.Create))
{
@ -34,7 +34,7 @@ namespace Volo.Blogging.Pages.Admin.Blogs
return Page();
}
public async Task<IActionResult> OnPostAsync()
public virtual async Task<IActionResult> OnPostAsync()
{
var blogDto = ObjectMapper.Map<BlogCreateModalView, CreateBlogDto>(Blog);

@ -29,7 +29,7 @@ namespace Volo.Blogging.Pages.Admin.Blogs
_authorization = authorization;
}
public async Task<ActionResult> OnGetAsync()
public virtual async Task<ActionResult> OnGetAsync()
{
if (!await _authorization.IsGrantedAsync(BloggingPermissions.Blogs.Update))
{
@ -43,7 +43,7 @@ namespace Volo.Blogging.Pages.Admin.Blogs
return Page();
}
public async Task OnPostAsync()
public virtual async Task<IActionResult> OnPostAsync()
{
await _blogAppService.Update(Blog.Id, new UpdateBlogDto()
{
@ -51,6 +51,8 @@ namespace Volo.Blogging.Pages.Admin.Blogs
ShortName = Blog.ShortName,
Description = Blog.Description
});
return Page();
}
public class BlogEditViewModel

@ -15,7 +15,7 @@ namespace Volo.Blogging.Pages.Admin.Blogs
_authorization = authorization;
}
public async Task<ActionResult> OnGetAsync()
public virtual async Task<ActionResult> OnGetAsync()
{
if (!await _authorization.IsGrantedAsync(BloggingPermissions.Blogs.Management))
{

@ -19,7 +19,7 @@ namespace Volo.Blogging.Pages.Blog
_blogAppService = blogAppService;
}
public async Task<IActionResult> OnGetAsync()
public virtual async Task<IActionResult> OnGetAsync()
{
var result = await _blogAppService.GetListAsync();

@ -46,12 +46,14 @@ namespace Volo.Blogging.Pages.Blog.Posts
_commentAppService = commentAppService;
}
public async Task OnGetAsync()
public virtual async Task<IActionResult> OnGetAsync()
{
await GetData();
return Page();
}
public async Task OnPostAsync()
public virtual async Task<IActionResult> OnPostAsync()
{
var comment = await _commentAppService.CreateAsync(new CreateCommentDto()
{
@ -63,6 +65,8 @@ namespace Volo.Blogging.Pages.Blog.Posts
FocusCommentId = comment.Id;
await GetData();
return Page();
}
private async Task GetData()

@ -33,7 +33,7 @@ namespace Volo.Blogging.Pages.Blog.Posts
_authorization = authorization;
}
public async Task<ActionResult> OnGetAsync()
public virtual async Task<ActionResult> OnGetAsync()
{
if (!await _authorization.IsGrantedAsync(BloggingPermissions.Posts.Update))
{
@ -47,7 +47,7 @@ namespace Volo.Blogging.Pages.Blog.Posts
return Page();
}
public async Task<ActionResult> OnPostAsync()
public virtual async Task<ActionResult> OnPostAsync()
{
var post = new UpdatePostDto
{

@ -35,11 +35,13 @@ namespace Volo.Blogging.Pages.Blog.Posts
_tagAppService = tagAppService;
}
public async Task OnGetAsync()
public virtual async Task<ActionResult> OnGetAsync()
{
Blog = await _blogAppService.GetByShortNameAsync(BlogShortName);
Posts = (await _postAppService.GetListByBlogIdAndTagName(Blog.Id, TagName)).Items;
PopularTags = (await _tagAppService.GetPopularTags(Blog.Id, new GetPopularTagsInput {ResultCount = 10, MinimumPostCount = 2}));
return Page();
}
}
}

@ -35,7 +35,7 @@ namespace Volo.Blogging.Pages.Blog.Posts
_blogOptions = blogOptions.Value;
}
public async Task<ActionResult> OnGetAsync()
public virtual async Task<ActionResult> OnGetAsync()
{
if (!await _authorization.IsGrantedAsync(BloggingPermissions.Posts.Create))
{
@ -51,7 +51,7 @@ namespace Volo.Blogging.Pages.Blog.Posts
return Page();
}
public async Task<ActionResult> OnPost()
public virtual async Task<ActionResult> OnPost()
{
var blog = await _blogAppService.GetAsync(Post.BlogId);

@ -1,13 +1,14 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Volo.ClientSimulation.Pages.ClientSimulation
{
public class IndexModel : PageModel
{
public async Task OnGetAsync()
public virtual Task<IActionResult> OnGetAsync()
{
return Task.FromResult<IActionResult>(Page());
}
}
}

@ -16,19 +16,19 @@ namespace Volo.ClientSimulation.Pages.ClientSimulation
Simulation = simulation;
}
public Task OnGetAsync()
public virtual Task<IActionResult> OnGetAsync()
{
Snapshot = Simulation.CreateSnapshot();
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
public async Task<IActionResult> OnPostStartAsync()
public virtual async Task<IActionResult> OnPostStartAsync()
{
Simulation.Start();
return new NoContentResult();
}
public async Task<IActionResult> OnPostStopAsync()
public virtual async Task<IActionResult> OnPostStopAsync()
{
Simulation.Stop();
return new NoContentResult();

@ -24,7 +24,7 @@ namespace VoloDocs.Web.Pages
_urlUiOptions = urlOptions.Value;
}
public async Task<IActionResult> OnGetAsync()
public virtual async Task<IActionResult> OnGetAsync()
{
var projects = await _projectAppService.GetListAsync();

@ -29,7 +29,7 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects
_projectAppService = projectAppService;
}
public async Task<ActionResult> OnGetAsync(string source)
public virtual async Task<ActionResult> OnGetAsync(string source)
{
if (source != null && source.ToLowerInvariant() == "github")
{
@ -42,7 +42,7 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects
}
}
public async Task<IActionResult> OnPostAsync()
public virtual async Task<IActionResult> OnPostAsync()
{
if (GithubProject != null)
{

@ -29,7 +29,7 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects
_projectAppService = projectAppService;
}
public async Task<ActionResult> OnGetAsync(Guid id)
public virtual async Task<ActionResult> OnGetAsync(Guid id)
{
var project = await _projectAppService.GetAsync(id);
@ -42,7 +42,7 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects
throw new BusinessException("UnknowDocumentSourceExceptionMessage");
}
public async Task<IActionResult> OnPostAsync()
public virtual async Task<IActionResult> OnPostAsync()
{
if (GithubProject != null)
{

@ -1,4 +1,6 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects
@ -6,8 +8,9 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects
[Authorize(DocsAdminPermissions.Projects.Default)]
public class IndexModel : DocsAdminPageModel
{
public void OnGet()
public virtual Task<IActionResult> OnGet()
{
return Task.FromResult<IActionResult>(Page());
}
}
}

@ -23,7 +23,7 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects
_documentAppService = documentAppService;
}
public async Task<ActionResult> OnGetAsync(Guid id)
public virtual async Task<ActionResult> OnGetAsync(Guid id)
{
var project = await _projectAppService.GetAsync(id);
@ -36,7 +36,7 @@ namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects
return Page();
}
public async Task<IActionResult> OnPostAsync()
public virtual async Task<IActionResult> OnPostAsync()
{
if (PullDocument.All)
{

@ -25,7 +25,7 @@ namespace Volo.Docs.Pages.Documents
_uiOptions = urlOptions.Value;
}
public async Task<IActionResult> OnGetAsync()
public virtual async Task<IActionResult> OnGetAsync()
{
DocumentsUrlPrefix = _uiOptions.RoutePrefix;

@ -92,7 +92,7 @@ namespace Volo.Docs.Pages.Documents.Project
_uiOptions = options.Value;
}
public async Task<IActionResult> OnGetAsync()
public virtual async Task<IActionResult> OnGetAsync()
{
try
{

@ -39,7 +39,7 @@ namespace Volo.Docs.Pages.Documents
public List<DocumentSearchOutput> SearchOutputs { get; set; } = new List<DocumentSearchOutput>();
public async Task<IActionResult> OnGetAsync(string keyword)
public virtual async Task<IActionResult> OnGetAsync(string keyword)
{
if (!await _documentAppService.FullSearchEnabledAsync())
{

@ -16,9 +16,9 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Roles
IdentityRoleAppService = identityRoleAppService;
}
public virtual Task OnGetAsync()
public virtual Task<IActionResult> OnGetAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
public virtual async Task<IActionResult> OnPostAsync()

@ -1,17 +1,18 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Volo.Abp.Identity.Web.Pages.Identity.Roles
{
public class IndexModel : IdentityPageModel
{
public virtual Task OnGetAsync()
public virtual Task<IActionResult> OnGetAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
public virtual Task OnPostAsync()
public virtual Task<IActionResult> OnPostAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
}
}

@ -25,7 +25,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
IdentityRoleAppService = identityRoleAppService;
}
public virtual async Task OnGetAsync()
public virtual async Task<IActionResult> OnGetAsync()
{
UserInfo = new UserInfoViewModel();
@ -37,6 +37,8 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
{
role.IsAssigned = role.IsDefault;
}
return Page();
}
public virtual async Task<NoContentResult> OnPostAsync()

@ -27,7 +27,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
IdentityRoleAppService = identityRoleAppService;
}
public virtual async Task OnGetAsync(Guid id)
public virtual async Task<IActionResult> OnGetAsync(Guid id)
{
UserInfo = ObjectMapper.Map<IdentityUserDto, UserInfoViewModel>(await IdentityUserAppService.GetAsync(id));
@ -41,6 +41,8 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users
role.IsAssigned = true;
}
}
return Page();
}
public virtual async Task<IActionResult> OnPostAsync()

@ -1,17 +1,18 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Volo.Abp.Identity.Web.Pages.Identity.Users
{
public class IndexModel : IdentityPageModel
{
public virtual Task OnGetAsync()
public virtual Task<IActionResult> OnGetAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
public virtual Task OnPostAsync()
public virtual Task<IActionResult> OnPostAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
}
}

@ -38,7 +38,7 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement
PermissionAppService = permissionAppService;
}
public virtual async Task OnGetAsync()
public virtual async Task<IActionResult> OnGetAsync()
{
ValidateModel();
@ -62,6 +62,8 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement
}
SelectAllInAllTabs = Groups.All(g => g.IsAllPermissionsGranted);
return Page();
}
public virtual async Task<IActionResult> OnPostAsync()

@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement
@ -16,7 +17,7 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement
Options = options.Value;
}
public virtual async Task OnGetAsync()
public virtual async Task<IActionResult> OnGetAsync()
{
SettingPageCreationContext = new SettingPageCreationContext(ServiceProvider);
@ -24,11 +25,13 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement
{
await contributor.ConfigureAsync(SettingPageCreationContext);
}
return Page();
}
public virtual Task OnPostAsync()
public virtual Task<IActionResult> OnPostAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
}
}

@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
@ -17,7 +17,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
TenantAppService = tenantAppService;
}
public virtual async Task OnGetAsync(Guid id)
public virtual async Task<IActionResult> OnGetAsync(Guid id)
{
var defaultConnectionString = await TenantAppService.GetDefaultConnectionStringAsync(id);
Tenant = new TenantInfoModel
@ -26,6 +26,8 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
DefaultConnectionString = defaultConnectionString,
UseSharedDatabase = defaultConnectionString.IsNullOrWhiteSpace()
};
return Page();
}
public virtual async Task<IActionResult> OnPostAsync()

@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
@ -16,9 +16,9 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
TenantAppService = tenantAppService;
}
public virtual Task OnGetAsync()
public virtual Task<IActionResult> OnGetAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
public virtual async Task<IActionResult> OnPostAsync()

@ -17,11 +17,13 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
TenantAppService = tenantAppService;
}
public virtual async Task OnGetAsync(Guid id)
public virtual async Task<IActionResult> OnGetAsync(Guid id)
{
Tenant = ObjectMapper.Map<TenantDto, TenantInfoModel>(
await TenantAppService.GetAsync(id)
);
return Page();
}
public virtual async Task<IActionResult> OnPostAsync()

@ -1,18 +1,19 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
{
public class IndexModel : TenantManagementPageModel
{
public virtual Task OnGetAsync()
public virtual Task<IActionResult> OnGetAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
public virtual Task OnPostAsync()
public virtual Task<IActionResult> OnPostAsync()
{
return Task.CompletedTask;
return Task.FromResult<IActionResult>(Page());
}
}
}
Loading…
Cancel
Save