Use string Interpolation for constructing Urls (#324)
This commit is contained in:
@ -28,7 +28,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<List<Module>> GetModulesAsync(int siteId)
|
||||
{
|
||||
List<Module> modules = await _http.GetJsonAsync<List<Module>>(Apiurl + "?siteid=" + siteId.ToString());
|
||||
List<Module> modules = await _http.GetJsonAsync<List<Module>>($"{Apiurl}?siteid={siteId.ToString()}");
|
||||
modules = modules
|
||||
.OrderBy(item => item.Order)
|
||||
.ToList();
|
||||
@ -37,7 +37,7 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Module> GetModuleAsync(int moduleId)
|
||||
{
|
||||
return await _http.GetJsonAsync<Module>(Apiurl + "/" + moduleId.ToString());
|
||||
return await _http.GetJsonAsync<Module>($"{Apiurl}/{moduleId.ToString()}");
|
||||
}
|
||||
|
||||
public async Task<Module> AddModuleAsync(Module module)
|
||||
@ -47,22 +47,22 @@ namespace Oqtane.Services
|
||||
|
||||
public async Task<Module> UpdateModuleAsync(Module module)
|
||||
{
|
||||
return await _http.PutJsonAsync<Module>(Apiurl + "/" + module.ModuleId.ToString(), module);
|
||||
return await _http.PutJsonAsync<Module>($"{Apiurl}/{module.ModuleId.ToString()}", module);
|
||||
}
|
||||
|
||||
public async Task DeleteModuleAsync(int moduleId)
|
||||
{
|
||||
await _http.DeleteAsync(Apiurl + "/" + moduleId.ToString());
|
||||
await _http.DeleteAsync($"{Apiurl}/{moduleId.ToString()}");
|
||||
}
|
||||
|
||||
public async Task<bool> ImportModuleAsync(int moduleId, string content)
|
||||
{
|
||||
return await _http.PostJsonAsync<bool>(Apiurl + "/import?moduleid=" + moduleId, content);
|
||||
return await _http.PostJsonAsync<bool>($"{Apiurl}/import?moduleid={moduleId}", content);
|
||||
}
|
||||
|
||||
public async Task<string> ExportModuleAsync(int moduleId)
|
||||
{
|
||||
return await _http.GetStringAsync(Apiurl + "/export?moduleid=" + moduleId.ToString());
|
||||
return await _http.GetStringAsync($"{Apiurl}/export?moduleid={moduleId.ToString()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user