Shady nagy/remove newton soft (#436)

* replace NewtonSoft with System.Text.Json

* not use auth for brande and types and use GetFromJsonAsync

* fix

* fix

* Auth HttpGet more simple.

* Put, Delete and Post  more simple.

* Fixed Edit for remove image and keep image and change other fields.
Added description required in Blazor Admin.

* Removed using not used

* Refactor AuthService and introduce HttpService. add validation for price.

* return null in HttpService if not success.

* Limt Price to 1000 mximum

* DI for Blazor Services

* one blazor service.

* fix
This commit is contained in:
Shady Nagy
2020-07-29 16:28:55 +02:00
committed by GitHub
parent 24cf9be6ae
commit b640926a19
24 changed files with 164 additions and 190 deletions

View File

@@ -12,7 +12,6 @@
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.5" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.7.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -2,10 +2,10 @@
using System.IO;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
using Microsoft.eShopWeb.Infrastructure.Data;
using Newtonsoft.Json;
namespace Microsoft.eShopWeb.Infrastructure.Services
{
@@ -49,7 +49,7 @@ namespace Microsoft.eShopWeb.Infrastructure.Services
DataBase64 = Convert.ToBase64String(fileData),
FileName = fileName
};
var content = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json");
var content = new StringContent(JsonSerializer.Serialize(request), Encoding.UTF8, "application/json");
using var message = await _httpClient.PostAsync(_url, content);
if (!message.IsSuccessStatusCode)