extensibility enhancements for site templates
This commit is contained in:
		| @ -24,19 +24,19 @@ namespace Oqtane.Services | ||||
|             get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "Installation"); } | ||||
|         } | ||||
|  | ||||
|         public async Task<GenericResponse> IsInstalled() | ||||
|         public async Task<Installation> IsInstalled() | ||||
|         { | ||||
|             return await _http.GetJsonAsync<GenericResponse>(Apiurl + "/installed"); | ||||
|             return await _http.GetJsonAsync<Installation>(Apiurl + "/installed"); | ||||
|         } | ||||
|  | ||||
|         public async Task<GenericResponse> Install(string connectionstring) | ||||
|         public async Task<Installation> Install(string connectionstring) | ||||
|         { | ||||
|             return await _http.PostJsonAsync<GenericResponse>(Apiurl, connectionstring); | ||||
|             return await _http.PostJsonAsync<Installation>(Apiurl, connectionstring); | ||||
|         } | ||||
|  | ||||
|         public async Task<GenericResponse> Upgrade() | ||||
|         public async Task<Installation> Upgrade() | ||||
|         { | ||||
|             return await _http.GetJsonAsync<GenericResponse>(Apiurl + "/upgrade"); | ||||
|             return await _http.GetJsonAsync<Installation>(Apiurl + "/upgrade"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -5,8 +5,8 @@ namespace Oqtane.Services | ||||
| { | ||||
|     public interface IInstallationService | ||||
|     { | ||||
|         Task<GenericResponse> IsInstalled(); | ||||
|         Task<GenericResponse> Install(string connectionstring); | ||||
|         Task<GenericResponse> Upgrade(); | ||||
|         Task<Installation> IsInstalled(); | ||||
|         Task<Installation> Install(string connectionstring); | ||||
|         Task<Installation> Upgrade(); | ||||
|     } | ||||
| } | ||||
|  | ||||
							
								
								
									
										11
									
								
								Oqtane.Client/Services/Interfaces/ISiteTemplateService.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Oqtane.Client/Services/Interfaces/ISiteTemplateService.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | ||||
| using Oqtane.Models; | ||||
| using System.Collections.Generic; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace Oqtane.Services | ||||
| { | ||||
|     public interface ISiteTemplateService | ||||
|     { | ||||
|         Task<List<SiteTemplate>> GetSiteTemplatesAsync(); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										35
									
								
								Oqtane.Client/Services/SiteTemplateService.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								Oqtane.Client/Services/SiteTemplateService.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | ||||
| using Oqtane.Models; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Net.Http; | ||||
| using System.Threading.Tasks; | ||||
| using Microsoft.AspNetCore.Components; | ||||
| using Oqtane.Shared; | ||||
|  | ||||
| namespace Oqtane.Services | ||||
| { | ||||
|     public class SiteTemplateService : ServiceBase, ISiteTemplateService | ||||
|     { | ||||
|         private readonly HttpClient _http; | ||||
|         private readonly SiteState _siteState; | ||||
|         private readonly NavigationManager _navigationManager; | ||||
|  | ||||
|         public SiteTemplateService(HttpClient http, SiteState siteState, NavigationManager navigationManager) | ||||
|         { | ||||
|             _http = http; | ||||
|             _siteState = siteState; | ||||
|             _navigationManager = navigationManager; | ||||
|         } | ||||
|  | ||||
|         private string Apiurl | ||||
|         { | ||||
|             get { return CreateApiUrl(_siteState.Alias, _navigationManager.Uri, "SiteTemplate"); } | ||||
|         } | ||||
|  | ||||
|         public async Task<List<SiteTemplate>> GetSiteTemplatesAsync() | ||||
|         { | ||||
|             List<SiteTemplate> siteTemplates = await _http.GetJsonAsync<List<SiteTemplate>>(Apiurl); | ||||
|             return siteTemplates.OrderBy(item => item.Name).ToList(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker