все апи починил: починить связи
This commit is contained in:
parent
5e5d8d588c
commit
33bdbcc6d0
@ -113,12 +113,12 @@ namespace ZooClientApp.Controllers
|
||||
[HttpGet]
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewBag.Canneds =
|
||||
APIClient.GetRequest<List<PreserveViewModel>>("api/main/getcannedlist");
|
||||
ViewBag.Routes =
|
||||
APIClient.GetRequest<List<PreserveViewModel>>("api/main/getRoutes");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void Create(int canned, int count)
|
||||
public void Create(int Route, int count)
|
||||
{
|
||||
if (APIClient.Client == null)
|
||||
{
|
||||
@ -128,7 +128,7 @@ namespace ZooClientApp.Controllers
|
||||
{
|
||||
throw new Exception("Количество и сумма должны быть больше 0");
|
||||
}
|
||||
APIClient.PostRequest("api/main/createorder", new
|
||||
APIClient.PostRequest("api/main/createroute", new
|
||||
RouteBindingModel
|
||||
{
|
||||
ClientId = APIClient.Client.Id
|
||||
|
@ -8,7 +8,7 @@
|
||||
<div class="row">
|
||||
<div class="col-4">Заповедник:</div>
|
||||
<div class="col-8">
|
||||
<select id="canned" name="canned" class="form-control" asp-items="@(new SelectList(@ViewBag.Preserves,"Id", "PreserveName"))"></select>
|
||||
<select id="preserve" name="preserve" class="form-control" asp-items="@(new SelectList(@ViewBag.Preserves,"Id", "PreserveName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - AbstractShowClientApp</title>
|
||||
<title>@ViewData["Title"] - ZooShowClientApp</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" />
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
@ -13,7 +13,7 @@
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" aspaction="Index">Абстрактный магазин</a>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" aspaction="Index">Зоопарк "Юрский период" - Клиент</a>
|
||||
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
@ -44,7 +44,7 @@
|
||||
</div>
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2020 - Абстрактный магазин - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a>
|
||||
© 2024 - Зоопарк "Юрский период" - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
|
@ -10,6 +10,8 @@ namespace ZooContracts.BindingModels
|
||||
public class PreserveBindingModel : IPreserveModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int EmployeeId { get; set; }
|
||||
public string PreserveName { get; set; } = string.Empty;
|
||||
public double PreservePrice { get; set; }
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ namespace ZooContracts.SearchModels
|
||||
public class PreserveSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? PreserveName { get; set; }
|
||||
}
|
||||
public int? EmployeeId { get; set; }
|
||||
public string? PreserveName { get; set; }
|
||||
public double PreservePrice { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ namespace ZooContracts.ViewModels
|
||||
{
|
||||
public class PreserveViewModel : IPreserveModel
|
||||
{
|
||||
public int EmployeeId { get; set; }
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название заповедника")]
|
||||
public string PreserveName { get; set; } = string.Empty;
|
||||
|
@ -15,6 +15,9 @@ namespace ZooDataBaseImplement.Models
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
|
||||
public int EmployeeId { get; set; }
|
||||
[Required]
|
||||
public string PreserveName { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public double PreservePrice { get; set; }
|
||||
|
@ -8,6 +8,7 @@ namespace ZooDataModels.Models
|
||||
{
|
||||
public interface IPreserveModel :IId
|
||||
{
|
||||
int EmployeeId { get; }
|
||||
string PreserveName { get; }
|
||||
double PreservePrice { get; }
|
||||
|
||||
|
@ -28,7 +28,7 @@ builder.Services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo
|
||||
{
|
||||
Title = "ComputersShopRestApi",
|
||||
Title = "JurasicZooRestApi",
|
||||
Version = "v1"
|
||||
});
|
||||
});
|
||||
@ -39,7 +39,7 @@ var app = builder.Build();
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "ComputersShopRestApi v1"));
|
||||
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "JurasicZooRestApi v1"));
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
@ -1,13 +0,0 @@
|
||||
namespace ZooRestApi
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
@ -114,20 +114,34 @@ namespace ZooShowEmployeeApp.Controllers
|
||||
Response.Redirect("Enter");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public IActionResult Create()
|
||||
public IActionResult CreatePreserve()
|
||||
{
|
||||
ViewBag.Preserver =
|
||||
ViewBag.Preserves =
|
||||
APIEmployee.GetRequest<List<PreserveViewModel>>("api/main/getpreservelist");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public double Calc(int count, int preserve)
|
||||
public void CreatePreserve(int preserve, int count)
|
||||
{
|
||||
var prod =
|
||||
APIEmployee.GetRequest<PreserveViewModel>($"api/main/getpreserve?preserveId={preserve}"
|
||||
);
|
||||
return count * (prod?.PreservePrice ?? 1);
|
||||
if (APIEmployee.Employee == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
if (count <= 0)
|
||||
{
|
||||
throw new Exception("Количество и сумма должны быть больше 0");
|
||||
}
|
||||
APIEmployee.PostRequest("api/main/createpreserve", new
|
||||
PreserveBindingModel
|
||||
{
|
||||
EmployeeId = APIEmployee.Employee.Id
|
||||
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
@{
|
||||
ViewData["Title"] = "Create";
|
||||
ViewData["Title"] = "CreatePreserve";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание Заповедника</h2>
|
||||
|
@ -6,6 +6,7 @@
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Маршруты</h1>
|
||||
</div>
|
||||
<a asp-action="CreatePreserve">Создать Маршруты</a>
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
|
@ -1,5 +1,5 @@
|
||||
@using ZooContracts.ViewModels
|
||||
@model ClientViewModel
|
||||
@model EmployeeViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
@ -11,7 +11,7 @@
|
||||
<div class="col-4">Логин:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="login"
|
||||
value="@Model.Email" />
|
||||
value="@Model.Login" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@ -25,7 +25,7 @@
|
||||
<div class="col-4">ФИО:</div>
|
||||
<div class="col-8">
|
||||
<input type="text" name="fio"
|
||||
value="@Model.ClientFIO" />
|
||||
value="@Model.EmployeeFIO" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -13,13 +13,16 @@
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Зоопарк "Юрский период"</a>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Зоопарк "Юрский период" - Сотрудник</a>
|
||||
<button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asparea="" asp-controller="Home" asp-action="Index">Заповедники</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user