Use string Interpolation for constructing Urls (#324)

This commit is contained in:
Hisham Bin Ateya
2020-04-03 19:44:54 +03:00
committed by GitHub
parent 2433cc06be
commit 7786cd027b
22 changed files with 124 additions and 108 deletions

View File

@ -28,13 +28,13 @@ namespace Oqtane.Services
public async Task<List<Profile>> GetProfilesAsync(int siteId)
{
List<Profile> profiles = await _http.GetJsonAsync<List<Profile>>(Apiurl + "?siteid=" + siteId.ToString());
List<Profile> profiles = await _http.GetJsonAsync<List<Profile>>($"{Apiurl}?siteid={siteId.ToString()}");
return profiles.OrderBy(item => item.ViewOrder).ToList();
}
public async Task<Profile> GetProfileAsync(int profileId)
{
return await _http.GetJsonAsync<Profile>(Apiurl + "/" + profileId.ToString());
return await _http.GetJsonAsync<Profile>($"{Apiurl}/{profileId.ToString()}");
}
public async Task<Profile> AddProfileAsync(Profile profile)
@ -44,11 +44,11 @@ namespace Oqtane.Services
public async Task<Profile> UpdateProfileAsync(Profile profile)
{
return await _http.PutJsonAsync<Profile>(Apiurl + "/" + profile.SiteId.ToString(), profile);
return await _http.PutJsonAsync<Profile>($"{Apiurl}/{profile.SiteId.ToString()}", profile);
}
public async Task DeleteProfileAsync(int profileId)
{
await _http.DeleteAsync(Apiurl + "/" + profileId.ToString());
await _http.DeleteAsync($"{Apiurl}/{profileId.ToString()}");
}
}
}