-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from sbwalker/master
Master
- Loading branch information
Showing
57 changed files
with
878 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Oqtane.Models; | ||
using System.Threading.Tasks; | ||
using System.Net.Http; | ||
using System.Linq; | ||
using Microsoft.AspNetCore.Components; | ||
using System.Collections.Generic; | ||
using Oqtane.Shared; | ||
|
||
namespace Oqtane.Services | ||
{ | ||
public class AliasService : ServiceBase, IAliasService | ||
{ | ||
private readonly HttpClient http; | ||
private readonly IUriHelper urihelper; | ||
|
||
public AliasService(HttpClient http, IUriHelper urihelper) | ||
{ | ||
this.http = http; | ||
this.urihelper = urihelper; | ||
} | ||
|
||
private string apiurl | ||
{ | ||
get { return CreateApiUrl(urihelper.GetAbsoluteUri(), "Alias"); } | ||
} | ||
|
||
public async Task<List<Alias>> GetAliasesAsync() | ||
{ | ||
List<Alias> aliases = await http.GetJsonAsync<List<Alias>>(apiurl); | ||
return aliases.OrderBy(item => item.Name).ToList(); | ||
} | ||
|
||
public async Task<Alias> GetAliasAsync(int AliasId) | ||
{ | ||
List<Alias> aliases = await http.GetJsonAsync<List<Alias>>(apiurl); | ||
return aliases.Where(item => item.AliasId == AliasId).FirstOrDefault(); | ||
} | ||
|
||
public async Task AddAliasAsync(Alias alias) | ||
{ | ||
await http.PostJsonAsync(apiurl, alias); | ||
} | ||
|
||
public async Task UpdateAliasAsync(Alias alias) | ||
{ | ||
await http.PutJsonAsync(apiurl + "/" + alias.AliasId.ToString(), alias); | ||
} | ||
public async Task DeleteAliasAsync(int AliasId) | ||
{ | ||
await http.DeleteAsync(apiurl + "/" + AliasId.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Oqtane.Models; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Oqtane.Services | ||
{ | ||
public interface IAliasService | ||
{ | ||
Task<List<Alias>> GetAliasesAsync(); | ||
|
||
Task<Alias> GetAliasAsync(int AliasId); | ||
|
||
Task AddAliasAsync(Alias alias); | ||
|
||
Task UpdateAliasAsync(Alias alias); | ||
|
||
Task DeleteAliasAsync(int AliasId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.