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

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.BaseAddress = new Uri(configuration["IPAddress"]);
_client.DefaultRequestHeaders.Accept.Clear(); _client.DefaultRequestHeaders.Accept.Clear();
_client.DefaultRequestHeaders.Accept.Add(new _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
MediaTypeWithQualityHeaderValue("application/json"));
} }
public static T? GetRequest<T>(string requestUrl) public static T? GetRequest<T>(string requestUrl)
{ {

View File

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

View File

@ -14,6 +14,10 @@
<ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" /> <ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" />
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" /> <ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
<ProjectReference Include="..\SushiBarDatabaseImplement\SushiBarDatabaseImplement.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> </ItemGroup>
</Project> </Project>

View File

@ -72,4 +72,4 @@
</tbody> </tbody>
</table> </table>
} }
</div> </div>