Merge branch 'lab5_base' into lab6_base

This commit is contained in:
ksenianeva 2023-05-15 01:11:50 +04:00
commit 383bdaac36
11 changed files with 158 additions and 104 deletions

View File

@ -33,6 +33,7 @@
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.условияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.условияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.путешествияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.путешествияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.отчетToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.отчетToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.списокУсловийToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.списокУсловийToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.условияПоПоездкамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.условияПоПоездкамToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -42,7 +43,6 @@
this.ButtonOrderReady = new System.Windows.Forms.Button(); this.ButtonOrderReady = new System.Windows.Forms.Button();
this.ButtonIssuedOrder = new System.Windows.Forms.Button(); this.ButtonIssuedOrder = new System.Windows.Forms.Button();
this.ButtonRef = new System.Windows.Forms.Button(); this.ButtonRef = new System.Windows.Forms.Button();
this.клиентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.menuStrip.SuspendLayout(); this.menuStrip.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -51,14 +51,15 @@
// //
this.dataGridView.BackgroundColor = System.Drawing.Color.White; this.dataGridView.BackgroundColor = System.Drawing.Color.White;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(4, 45); this.dataGridView.Location = new System.Drawing.Point(3, 36);
this.dataGridView.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.dataGridView.MultiSelect = false; this.dataGridView.MultiSelect = false;
this.dataGridView.Name = "dataGridView"; this.dataGridView.Name = "dataGridView";
this.dataGridView.RowHeadersVisible = false; this.dataGridView.RowHeadersVisible = false;
this.dataGridView.RowHeadersWidth = 62; this.dataGridView.RowHeadersWidth = 62;
this.dataGridView.RowTemplate.Height = 33; this.dataGridView.RowTemplate.Height = 33;
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView.Size = new System.Drawing.Size(1201, 520); this.dataGridView.Size = new System.Drawing.Size(1209, 416);
this.dataGridView.TabIndex = 0; this.dataGridView.TabIndex = 0;
// //
// menuStrip // menuStrip
@ -69,7 +70,8 @@
this.отчетToolStripMenuItem}); this.отчетToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0); this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip"; this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(1452, 33); this.menuStrip.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2);
this.menuStrip.Size = new System.Drawing.Size(1408, 28);
this.menuStrip.TabIndex = 1; this.menuStrip.TabIndex = 1;
this.menuStrip.Text = "menuStrip1"; this.menuStrip.Text = "menuStrip1";
// //
@ -80,23 +82,30 @@
this.путешествияToolStripMenuItem, this.путешествияToolStripMenuItem,
this.клиентыToolStripMenuItem}); this.клиентыToolStripMenuItem});
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(139, 29); this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
this.справочникиToolStripMenuItem.Text = "Справочники"; this.справочникиToolStripMenuItem.Text = "Справочники";
// //
// условияToolStripMenuItem // условияToolStripMenuItem
// //
this.условияToolStripMenuItem.Name = "условияToolStripMenuItem"; this.условияToolStripMenuItem.Name = "условияToolStripMenuItem";
this.условияToolStripMenuItem.Size = new System.Drawing.Size(270, 34); this.условияToolStripMenuItem.Size = new System.Drawing.Size(182, 26);
this.условияToolStripMenuItem.Text = "Условия"; this.условияToolStripMenuItem.Text = "Условия";
this.условияToolStripMenuItem.Click += new System.EventHandler(this.условияToolStripMenuItem_Click); this.условияToolStripMenuItem.Click += new System.EventHandler(this.условияToolStripMenuItem_Click);
// //
// путешествияToolStripMenuItem // путешествияToolStripMenuItem
// //
this.путешествияToolStripMenuItem.Name = "путешествияToolStripMenuItem"; this.путешествияToolStripMenuItem.Name = "путешествияToolStripMenuItem";
this.путешествияToolStripMenuItem.Size = new System.Drawing.Size(270, 34); this.путешествияToolStripMenuItem.Size = new System.Drawing.Size(182, 26);
this.путешествияToolStripMenuItem.Text = "Путешествия"; this.путешествияToolStripMenuItem.Text = "Путешествия";
this.путешествияToolStripMenuItem.Click += new System.EventHandler(this.путешествияToolStripMenuItem_Click); this.путешествияToolStripMenuItem.Click += new System.EventHandler(this.путешествияToolStripMenuItem_Click);
// //
// клиентыToolStripMenuItem
//
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(182, 26);
this.клиентыToolStripMenuItem.Text = "Клиенты";
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
//
// отчетToolStripMenuItem // отчетToolStripMenuItem
// //
this.отчетToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.отчетToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -104,35 +113,36 @@
this.условияПоПоездкамToolStripMenuItem, this.условияПоПоездкамToolStripMenuItem,
this.списокЗаказовToolStripMenuItem}); this.списокЗаказовToolStripMenuItem});
this.отчетToolStripMenuItem.Name = "отчетToolStripMenuItem"; this.отчетToolStripMenuItem.Name = "отчетToolStripMenuItem";
this.отчетToolStripMenuItem.Size = new System.Drawing.Size(75, 29); this.отчетToolStripMenuItem.Size = new System.Drawing.Size(62, 24);
this.отчетToolStripMenuItem.Text = "Отчет"; this.отчетToolStripMenuItem.Text = "Отчет";
// //
// списокУсловийToolStripMenuItem // списокУсловийToolStripMenuItem
// //
this.списокУсловийToolStripMenuItem.Name = "списокУсловийToolStripMenuItem"; this.списокУсловийToolStripMenuItem.Name = "списокУсловийToolStripMenuItem";
this.списокУсловийToolStripMenuItem.Size = new System.Drawing.Size(291, 34); this.списокУсловийToolStripMenuItem.Size = new System.Drawing.Size(243, 26);
this.списокУсловийToolStripMenuItem.Text = "Список путешествий"; this.списокУсловийToolStripMenuItem.Text = "Список путешествий";
this.списокУсловийToolStripMenuItem.Click += new System.EventHandler(this.ConditionsToolStripMenuItem_Click); this.списокУсловийToolStripMenuItem.Click += new System.EventHandler(this.ConditionsToolStripMenuItem_Click);
// //
// условияПоПоездкамToolStripMenuItem // условияПоПоездкамToolStripMenuItem
// //
this.условияПоПоездкамToolStripMenuItem.Name = "условияПоПоездкамToolStripMenuItem"; this.условияПоПоездкамToolStripMenuItem.Name = "условияПоПоездкамToolStripMenuItem";
this.условияПоПоездкамToolStripMenuItem.Size = new System.Drawing.Size(291, 34); this.условияПоПоездкамToolStripMenuItem.Size = new System.Drawing.Size(243, 26);
this.условияПоПоездкамToolStripMenuItem.Text = "Условия по поездкам"; this.условияПоПоездкамToolStripMenuItem.Text = "Условия по поездкам";
this.условияПоПоездкамToolStripMenuItem.Click += new System.EventHandler(this.ConditionTravelsToolStripMenuItem_Click); this.условияПоПоездкамToolStripMenuItem.Click += new System.EventHandler(this.ConditionTravelsToolStripMenuItem_Click);
// //
// списокЗаказовToolStripMenuItem // списокЗаказовToolStripMenuItem
// //
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem"; this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(291, 34); this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(243, 26);
this.списокЗаказовToolStripMenuItem.Text = "Список заказов"; this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click); this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
// //
// buttonCreateOrder // buttonCreateOrder
// //
this.buttonCreateOrder.Location = new System.Drawing.Point(1224, 55); this.buttonCreateOrder.Location = new System.Drawing.Point(1224, 36);
this.buttonCreateOrder.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.buttonCreateOrder.Name = "buttonCreateOrder"; this.buttonCreateOrder.Name = "buttonCreateOrder";
this.buttonCreateOrder.Size = new System.Drawing.Size(216, 34); this.buttonCreateOrder.Size = new System.Drawing.Size(173, 27);
this.buttonCreateOrder.TabIndex = 2; this.buttonCreateOrder.TabIndex = 2;
this.buttonCreateOrder.Text = "Создать заказ"; this.buttonCreateOrder.Text = "Создать заказ";
this.buttonCreateOrder.UseVisualStyleBackColor = true; this.buttonCreateOrder.UseVisualStyleBackColor = true;
@ -140,9 +150,10 @@
// //
// ButtonTakeOrderInWork // ButtonTakeOrderInWork
// //
this.ButtonTakeOrderInWork.Location = new System.Drawing.Point(1224, 124); this.ButtonTakeOrderInWork.Location = new System.Drawing.Point(1224, 91);
this.ButtonTakeOrderInWork.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.ButtonTakeOrderInWork.Name = "ButtonTakeOrderInWork"; this.ButtonTakeOrderInWork.Name = "ButtonTakeOrderInWork";
this.ButtonTakeOrderInWork.Size = new System.Drawing.Size(216, 34); this.ButtonTakeOrderInWork.Size = new System.Drawing.Size(173, 27);
this.ButtonTakeOrderInWork.TabIndex = 3; this.ButtonTakeOrderInWork.TabIndex = 3;
this.ButtonTakeOrderInWork.Text = "Отдать на выполнение"; this.ButtonTakeOrderInWork.Text = "Отдать на выполнение";
this.ButtonTakeOrderInWork.UseVisualStyleBackColor = true; this.ButtonTakeOrderInWork.UseVisualStyleBackColor = true;
@ -150,9 +161,10 @@
// //
// ButtonOrderReady // ButtonOrderReady
// //
this.ButtonOrderReady.Location = new System.Drawing.Point(1224, 203); this.ButtonOrderReady.Location = new System.Drawing.Point(1224, 154);
this.ButtonOrderReady.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.ButtonOrderReady.Name = "ButtonOrderReady"; this.ButtonOrderReady.Name = "ButtonOrderReady";
this.ButtonOrderReady.Size = new System.Drawing.Size(216, 34); this.ButtonOrderReady.Size = new System.Drawing.Size(173, 27);
this.ButtonOrderReady.TabIndex = 4; this.ButtonOrderReady.TabIndex = 4;
this.ButtonOrderReady.Text = "Заказ готов"; this.ButtonOrderReady.Text = "Заказ готов";
this.ButtonOrderReady.UseVisualStyleBackColor = true; this.ButtonOrderReady.UseVisualStyleBackColor = true;
@ -160,9 +172,10 @@
// //
// ButtonIssuedOrder // ButtonIssuedOrder
// //
this.ButtonIssuedOrder.Location = new System.Drawing.Point(1224, 267); this.ButtonIssuedOrder.Location = new System.Drawing.Point(1224, 206);
this.ButtonIssuedOrder.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.ButtonIssuedOrder.Name = "ButtonIssuedOrder"; this.ButtonIssuedOrder.Name = "ButtonIssuedOrder";
this.ButtonIssuedOrder.Size = new System.Drawing.Size(216, 34); this.ButtonIssuedOrder.Size = new System.Drawing.Size(173, 27);
this.ButtonIssuedOrder.TabIndex = 5; this.ButtonIssuedOrder.TabIndex = 5;
this.ButtonIssuedOrder.Text = "Заказ выдан"; this.ButtonIssuedOrder.Text = "Заказ выдан";
this.ButtonIssuedOrder.UseVisualStyleBackColor = true; this.ButtonIssuedOrder.UseVisualStyleBackColor = true;
@ -170,26 +183,20 @@
// //
// ButtonRef // ButtonRef
// //
this.ButtonRef.Location = new System.Drawing.Point(1224, 338); this.ButtonRef.Location = new System.Drawing.Point(1224, 262);
this.ButtonRef.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.ButtonRef.Name = "ButtonRef"; this.ButtonRef.Name = "ButtonRef";
this.ButtonRef.Size = new System.Drawing.Size(216, 34); this.ButtonRef.Size = new System.Drawing.Size(173, 27);
this.ButtonRef.TabIndex = 6; this.ButtonRef.TabIndex = 6;
this.ButtonRef.Text = "Обновить список"; this.ButtonRef.Text = "Обновить список";
this.ButtonRef.UseVisualStyleBackColor = true; this.ButtonRef.UseVisualStyleBackColor = true;
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click); this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
// //
// клиентыToolStripMenuItem
//
this.клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
this.клиентыToolStripMenuItem.Size = new System.Drawing.Size(270, 34);
this.клиентыToolStripMenuItem.Text = "Клиенты";
this.клиентыToolStripMenuItem.Click += new System.EventHandler(this.клиентыToolStripMenuItem_Click);
//
// FormMain // FormMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1452, 577); this.ClientSize = new System.Drawing.Size(1408, 462);
this.Controls.Add(this.ButtonRef); this.Controls.Add(this.ButtonRef);
this.Controls.Add(this.ButtonIssuedOrder); this.Controls.Add(this.ButtonIssuedOrder);
this.Controls.Add(this.ButtonOrderReady); this.Controls.Add(this.ButtonOrderReady);
@ -198,6 +205,7 @@
this.Controls.Add(this.dataGridView); this.Controls.Add(this.dataGridView);
this.Controls.Add(this.menuStrip); this.Controls.Add(this.menuStrip);
this.MainMenuStrip = this.menuStrip; this.MainMenuStrip = this.menuStrip;
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "FormMain"; this.Name = "FormMain";
this.Text = "Туристическая фирма"; this.Text = "Туристическая фирма";
this.Load += new System.EventHandler(this.FormMain_Load); this.Load += new System.EventHandler(this.FormMain_Load);

View File

@ -34,6 +34,7 @@ namespace TravelCompany
dataGridView.Columns["TravelId"].Visible = false; dataGridView.Columns["TravelId"].Visible = false;
dataGridView.Columns["ClientId"].Visible = false; dataGridView.Columns["ClientId"].Visible = false;
dataGridView.Columns["TravelName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView.Columns["TravelName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@ -3,7 +3,7 @@ using Newtonsoft.Json;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Text; using System.Text;
namespace PrecastConcretePlantClientApp namespace TravelCompanyClientApp
{ {
public class APIClient public class APIClient
{ {

View File

@ -1,12 +1,12 @@
using TravelCompanyContracts.BindingModels; using Microsoft.AspNetCore.Mvc;
using TravelCompanyContracts.ViewModels;
using TravelCompanyClientApp.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using TravelCompanyClientApp; using TravelCompanyClientApp;
using PrecastConcretePlantClientApp; using System.Diagnostics;
using TravelCompanyClientApp.Models;
using TravelCompanyContracts.BindingModels;
using TravelCompanyContracts.ViewModels;
namespace TravelCompanyClientApp.Controllers
namespace AbstractShowClientApp.Controllers
{ {
public class HomeController : Controller public class HomeController : Controller
{ {
@ -76,7 +76,8 @@ namespace TravelCompanyClientApp.Controllers
[HttpPost] [HttpPost]
public void Enter(string login, string password) public void Enter(string login, string password)
{ {
if (string.IsNullOrEmpty(login) ||string.IsNullOrEmpty(password)) if (string.IsNullOrEmpty(login) ||
string.IsNullOrEmpty(password))
{ {
throw new Exception("Введите логин и пароль"); throw new Exception("Введите логин и пароль");
} }
@ -101,7 +102,8 @@ namespace TravelCompanyClientApp.Controllers
{ {
throw new Exception("Введите логин, пароль и ФИО"); throw new Exception("Введите логин, пароль и ФИО");
} }
APIClient.PostRequest("api/client/register", new ClientBindingModel APIClient.PostRequest("api/client/register", new
ClientBindingModel
{ {
ClientFIO = fio, ClientFIO = fio,
Email = login, Email = login,
@ -113,8 +115,7 @@ namespace TravelCompanyClientApp.Controllers
[HttpGet] [HttpGet]
public IActionResult Create() public IActionResult Create()
{ {
ViewBag.Products = ViewBag.Travels = APIClient.GetRequest<List<TravelViewModel>>("api/main/gettravellist");
APIClient.GetRequest<List<TravelViewModel>>("api/main/gettravellist");
return View(); return View();
} }
[HttpPost] [HttpPost]

View File

@ -1,5 +1,3 @@
using PrecastConcretePlantClientApp;
using TravelCompanyClientApp;
using TravelCompanyClientApp; using TravelCompanyClientApp;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);

View File

@ -1,51 +1,48 @@
@{ @{
ViewData["Title"] = "Create"; ViewData["Title"] = "Create";
} }
<div class="text-center"> <div class="text-center">
<h2 class="display-4">Создание заказа</h2> <h2 class="display-4">Создание заказа</h2>
</div> </div>
<form method="post"> <form method="post">
<div class="row"> <div class="row">
<div class="col-4">Изделие:</div> <div class="col-4">Путешествие:</div>
<div class="col-8"> <div class="col-8">
<select id="product" name="product" class="form-control" aspitems="@(new SelectList(@ViewBag.Products,"Id", "ProductName"))"></select> <select id="travel" name="travel" class="form-control" asp-items="@(new SelectList(@ViewBag.Travels,"Id", "TravelName"))"></select>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-4">Количество:</div> <div class="col-4">Количество:</div>
<div class="col-8"><input type="text" name="count" id="count" <div class="col-8"><input type="text" name="count" id="count"/></div>
/></div> </div>
</div> <div class="row">
<div class="row"> <div class="col-4">Сумма:</div>
<div class="col-4">Сумма:</div> <div class="col-8"><input type="text" id="sum" name="sum" readonly/></div>
<div class="col-8"><input type="text" id="sum" name="sum" readonly </div>
/></div> <div class="row">
</div> <div class="col-8"></div>
<div class="row"> <div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
<div class="col-8"></div> </div>
<div class="col-4"><input type="submit" value="Создать" class="btn
btn-primary" /></div>
</div>
</form> </form>
<script> <script>
$('#product').on('change', function () { $('#travel').on('change', function () {
check(); check();
}); });
$('#count').on('change', function () { $('#count').on('change', function () {
check(); check();
}); });
function check() { function check() {
var count = $('#count').val(); var count = $('#count').val();
var product = $('#product').val(); var travel = $('#travel').val();
if (count && product) { if (count && travel) {
$.ajax({ $.ajax({
method: "POST", method: "POST",
url: "/Home/Calc", url: "/Home/Calc",
data: { count: count, product: product }, data: { count: count, travel: travel },
success: function (result) { success: function (result) {
$("#sum").val(result); $("#sum").val(result);
} }
}); });
}; };
} }
</script> </script>

View File

@ -1,8 +1,57 @@
@{ @using TravelCompanyContracts.ViewModels
ViewData["Title"] = "Home Page"; @model List<OrderViewModel>
@{
ViewData["Title"] = "Home Page";
} }
<div class="text-center"> <div class="text-center">
<h1 class="display-4">Welcome</h1> <h1 class="display-4">Заказы</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div> </div>
<div class="text-center">
@{
if (Model == null)
{
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<p>
<a asp-action="Create">Создать заказ</a>
</p>
<table class="table">
<thead>
<tr>
<th>Номер</th>
<th>Изделие</th>
<th>Дата создания</th>
<th>Количество</th>
<th>Сумма</th>
<th>Статус</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.TravelName)
</td>
<td>
@Html.DisplayFor(modelItem => item.DateCreate)
</td>
<td>
@Html.DisplayFor(modelItem => item.Count)
</td>
<td>
@Html.DisplayFor(modelItem => item.Sum)
</td>
<td>
@Html.DisplayFor(modelItem => item.Status)
</td>
</tr>
}
</tbody>
</table>
}
</div>

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - AbstractShowClientApp</title> <title>@ViewData["Title"] - TravelCompanyClientApp</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" /> <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" /> <link rel="stylesheet" href="~/css/site.css" />
<script src="~/lib/jquery/dist/jquery.min.js"></script> <script src="~/lib/jquery/dist/jquery.min.js"></script>
@ -13,7 +13,7 @@
<header> <header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3"> <nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bgwhite border-bottom box-shadow mb-3">
<div class="container"> <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" <button class="navbar-toggler" type="button" datatoggle="collapse" data-target=".navbar-collapse" ariacontrols="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation"> aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
@ -44,7 +44,7 @@
</div> </div>
<footer class="border-top footer text-muted"> <footer class="border-top footer text-muted">
<div class="container"> <div class="container">
&copy; 2020 - Абстрактный магазин - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a> &copy; 2023 - Туристическая фирма - <a asp-area="" aspcontroller="Home" asp-action="Privacy">Личные данные</a>
</div> </div>
</footer> </footer>
<script src="~/js/site.js" asp-append-version="true"></script> <script src="~/js/site.js" asp-append-version="true"></script>

View File

@ -23,15 +23,16 @@ namespace TravelCompanyDatabaseImplement.Implements
} }
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue) if (!model.ClientId.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
{ {
return new(); return new();
} }
if (!model.DateFrom.HasValue || !model.DateTo.HasValue) if (model.DateFrom.HasValue && model.DateTo.HasValue)
{ {
using var context = new TravelCompanyDatabase(); using var context = new TravelCompanyDatabase();
return context.Orders.Include(x => x.Client) return context.Orders.Include(x => x.Client)
.Where(x => x.Id == model.Id) .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
.Select(x => AccessTravelStorage(x.GetViewModel, context)) .Select(x => AccessTravelStorage(x.GetViewModel, context))
.ToList(); .ToList();
} }
@ -47,7 +48,7 @@ namespace TravelCompanyDatabaseImplement.Implements
{ {
using var context = new TravelCompanyDatabase(); using var context = new TravelCompanyDatabase();
return context.Orders.Include(x => x.Client) return context.Orders.Include(x => x.Client)
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate<=model.DateTo) .Where(x => x.Id == model.Id)
.Select(x => AccessTravelStorage(x.GetViewModel, context)) .Select(x => AccessTravelStorage(x.GetViewModel, context))
.ToList(); .ToList();
} }
@ -59,6 +60,7 @@ namespace TravelCompanyDatabaseImplement.Implements
{ {
return new(); return new();
} }
using var context = new TravelCompanyDatabase(); using var context = new TravelCompanyDatabase();
return AccessTravelStorage(context.Orders.Include(x => x.Client) return AccessTravelStorage(context.Orders.Include(x => x.Client)
.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id) .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)

View File

@ -50,7 +50,6 @@ namespace TravelCompanyDatabaseImplement.Implements
using var context = new TravelCompanyDatabase(); using var context = new TravelCompanyDatabase();
return context.Travels return context.Travels
.Include(x => x.Conditions) .Include(x => x.Conditions)
.ThenInclude(x => x.Condition)
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.TravelName) && x.TravelName == model.TravelName) || .FirstOrDefault(x => (!string.IsNullOrEmpty(model.TravelName) && x.TravelName == model.TravelName) ||
(model.Id.HasValue && x.Id == model.Id)) (model.Id.HasValue && x.Id == model.Id))
?.GetViewModel; ?.GetViewModel;

View File

@ -34,20 +34,19 @@ namespace AbstractShopRestApi.Controllers
} }
} }
[HttpGet] [HttpGet]
public TravelViewModel? GetTravel(int productId) public TravelViewModel? GetTravel(int travelId)
{ {
try try
{ {
return _product.ReadElement(new TravelSearchModel return _product.ReadElement(new TravelSearchModel
{ {
Id = Id = travelId
productId
}); });
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Ошибка получения продукта по id={Id}", _logger.LogError(ex, "Ошибка получения продукта по id={Id}",
productId); travelId);
throw; throw;
} }
} }