не работает...

This commit is contained in:
Андрей Байгулов 2024-05-03 22:37:05 +04:00
parent 704426540e
commit 3b9bca0157
4 changed files with 9 additions and 9 deletions

View File

@ -13,8 +13,7 @@ namespace SushiBarClientApp
{
_client.BaseAddress = new Uri(configuration["IPAddress"]);
_client.DefaultRequestHeaders.Accept.Clear();
_client.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/json"));
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
public static T? GetRequest<T>(string requestUrl)
{

View File

@ -19,8 +19,7 @@ namespace SushiBarClientApp.Controllers
{
return Redirect("~/Home/Enter");
}
return
View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
return View(APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorders?clientId={APIClient.Client.Id}"));
}
[HttpGet]
public IActionResult Privacy()
@ -139,10 +138,8 @@ namespace SushiBarClientApp.Controllers
[HttpPost]
public double Calc(int count, int sushi)
{
var prod =
APIClient.GetRequest<SushiViewModel>($"api/main/getsushi?sushiId={sushi}"
);
return count * (prod?.Price ?? 1);
var sush = APIClient.GetRequest<SushiViewModel>($"api/main/getsushi?sushiId={sushi}");
return count * (sush?.Price ?? 1);
}
}
}

View File

@ -14,6 +14,10 @@
<ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" />
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
<ProjectReference Include="..\SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj" />
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
<ProjectReference Include="..\SushiBarFileImplement\SushiBarFileImplement.csproj" />
<ProjectReference Include="..\SushiBarListImplement\SushiBarListImplement.csproj" />
<ProjectReference Include="..\SushiBarRestApi\SushiBarRestApi.csproj" />
</ItemGroup>
</Project>