Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 lines
1.1 KiB

using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Volo.Docs;
using Volo.Docs.Projects;
namespace VoloDocs.Web.Pages
{
public class IndexModel : PageModel
{
public IReadOnlyList<ProjectDto> Projects { get; set; }
private readonly IProjectAppService _projectAppService;
public IndexModel(IProjectAppService projectAppService)
{
_projectAppService = projectAppService;
}
public async Task<IActionResult> OnGetAsync()
{
Projects = (await _projectAppService.GetListAsync()).Items;
if (Projects.Count == 1)
{
return RedirectToPage("./Documents/Project/Index", new
{
projectName = Projects[0].ShortName,
version = DocsAppConsts.Latest,
languageCode = "",
documentName = Projects[0].DefaultDocumentName
});
}
return Page();
}
}
}