1 часть готова
This commit is contained in:
parent
9d1081da98
commit
389a872716
@ -503,24 +503,27 @@ namespace HostrelHeadwaiterApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.ConferenceBookings = APIClient.GetRequest<List<ConferenceBookingViewModel>>($"api/main/getconferenceBookinglist?headwaiterId={APIClient.Headwaiter.Id}");
|
||||
ViewBag.Dinners = APIClient.GetRequest<List<DinnerViewModel>>($"api/main/getdinnerlist?headwaiterId={APIClient.Headwaiter.Id}");
|
||||
return View();
|
||||
return View(Tuple.Create(APIClient.GetRequest<List<ConferenceBookingViewModel>>($"api/main/getconferencebookinglist?headwaiterId={APIClient.Headwaiter.Id}"),
|
||||
APIClient.GetRequest<List<DinnerViewModel>>($"api/main/getdinnerlist?headwaiterId={APIClient.Headwaiter.Id}"))); return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public void AddDinnerToConferenceBooking(int conferenceBooking, int dinner)
|
||||
public void AddDinnerToConferenceBooking(int conferenceBooking, int[] dinner)
|
||||
{
|
||||
if (APIClient.Headwaiter == null)
|
||||
{
|
||||
throw new Exception("Необходима авторизация");
|
||||
}
|
||||
APIClient.PostRequest("api/main/AddDinnerToConferenceBooking", Tuple.Create(
|
||||
for (int i = 0; i < dinner.Length; i++)
|
||||
{
|
||||
APIClient.PostRequest("api/main/AddDinnerToConferenceBooking", Tuple.Create(
|
||||
new ConferenceBookingSearchModel() { Id = conferenceBooking },
|
||||
new DinnerViewModel() { Id = dinner }
|
||||
new DinnerViewModel() { Id = dinner[i] }
|
||||
));
|
||||
}
|
||||
Response.Redirect("ListConferenceBookings");
|
||||
}
|
||||
|
||||
|
||||
public IActionResult ListConferenceBookings()
|
||||
{
|
||||
@ -693,30 +696,41 @@ namespace HostrelHeadwaiterApp.Controllers
|
||||
_logger.LogError(ex, "Ошибка создания отчета");
|
||||
throw;
|
||||
}
|
||||
double sum = 0;
|
||||
string table = "";
|
||||
table += $"<h2 class=\"u-text u-text-custom-color-1 u-text-default u-text-1\">Предварительный отчет</h2>";
|
||||
table += $"<table class=\"u-table-entity\">";
|
||||
table += "<colgroup>";
|
||||
table += "<col width=\"20%\" />";
|
||||
table += "<col width=\"20%\" />";
|
||||
table += "<col width=\"20%\" />";
|
||||
table += "<col width=\"20%\" />";
|
||||
table += "<col width=\"20%\" />";
|
||||
table += "</colgroup>";
|
||||
table += "<thead class=\"u-custom-color-1 u-table-header u-table-header-1\">";
|
||||
table += "<tr style=\"height: 31px\">";
|
||||
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\">Обед</th>";
|
||||
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\">Имя комнаты</th>";
|
||||
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\">Цена комнаты</th>";
|
||||
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\">Название зала</th>";
|
||||
table += $"<th class=\"u-border-1 u-border-grey-50 u-table-cell\">Дата броинирования</th>";
|
||||
table += "</tr>";
|
||||
table += "</thead>";
|
||||
foreach (var report in result)
|
||||
{
|
||||
table += $"<h2>{report.DinnerName}</h2>";
|
||||
table += $"<table>";
|
||||
table += "<thead>";
|
||||
table += "<tr>";
|
||||
table += $"<th>Имя комнаты</th>";
|
||||
table += $"<th>Цена комнаты</th>";
|
||||
table += $"<th>Название зала</th>";
|
||||
table += $"<th>Дата броинирования</th>";
|
||||
table += "</tr>";
|
||||
table += "</thead>";
|
||||
table += "<tbody>";
|
||||
table += "<tr>";
|
||||
table += $"<td>{report.RoomName}</td>";
|
||||
table += $"<td>{report.RoomPrice}</td>";
|
||||
table += $"<td>{report.NameHall}</td>";
|
||||
table += $"<td>{report.BookingDate}</td>";
|
||||
table += "<tbody class=\"u-table-body\">";
|
||||
table += "<tr style=\"height: 75px\">";
|
||||
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.DinnerName}</td>";
|
||||
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.RoomName}</td>";
|
||||
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.RoomPrice}</td>";
|
||||
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.NameHall}</td>";
|
||||
table += $"<td class=\"u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell\">{report.BookingDate}</td>";
|
||||
table += "</tr>";
|
||||
table += "</tbody>";
|
||||
table += "</table>";
|
||||
sum += report.RoomPrice;
|
||||
}
|
||||
//table += $"<h3 style=\"align-self: self-start;\">Итого: {result.Item2}</h3>";
|
||||
table += "</table>";
|
||||
table += $"<h2 class=\"u-text u-text-custom-color-1 u-text-default u-text-1\">Итого: {sum}</h2>";
|
||||
return table;
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,76 @@
|
||||
@using HotelContracts.ViewModels;
|
||||
@using HotelContracts.ViewModels;
|
||||
@using HotelDataModels.Models;
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "AddDinnerToConferenceBooking";
|
||||
}
|
||||
|
||||
@model Dictionary<int, IDinnerModel>
|
||||
@model Tuple<List<ConferenceBookingViewModel>, List<DinnerViewModel>>
|
||||
|
||||
<form method="post">
|
||||
<div class="u-form-group u-form-name u-label-top">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Бронирование: </label>
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">План питания: </label>
|
||||
<div class="u-input u-input-rectangle">
|
||||
<select id="conferenceBooking" name="conferenceBooking" class="form-control" asp-items="@(new SelectList(@ViewBag.ConferenceBookings, "Id", "NameHall"))"></select>
|
||||
<select id="conferenceBooking" name="conferenceBooking" class="form-control">
|
||||
@foreach (var conferenceBooking in Model.Item1)
|
||||
{
|
||||
<option value="@conferenceBooking.Id">
|
||||
@Html.DisplayFor(modelItem => conferenceBooking.NameHall)
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-form-group u-form-name u-label-top">
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Обеды: </label>
|
||||
<div class="u-input u-input-rectangle">
|
||||
<select id="dinner" name="dinner" class="form-control" asp-items="@(new SelectList(@ViewBag.Dinners, "Id", "DinnerName"))"></select>
|
||||
</div>
|
||||
<label class="u-label u-text-custom-color-1 u-label-1">Участники: </label>
|
||||
<div class="u-container-style u-layout-cell u-size-48 u-layout-cell-1">
|
||||
<div class="u-container-layout u-container-layout-1">
|
||||
<div class="u-table u-table-responsive u-table-1">
|
||||
<table class="u-table-entity">
|
||||
<colgroup>
|
||||
<col width="9.8%" />
|
||||
<col width="62.9%" />
|
||||
<col width="27.3%" />
|
||||
</colgroup>
|
||||
<thead
|
||||
class="u-custom-color-1 u-table-header u-table-header-1">
|
||||
<tr style="height: 31px">
|
||||
<th class="u-border-1 u-border-grey-50 u-table-cell">
|
||||
|
||||
</th>
|
||||
<th class="u-border-1 u-border-grey-50 u-table-cell">
|
||||
ФИО участника
|
||||
</th>
|
||||
<th class="u-border-1 u-border-grey-50 u-table-cell">
|
||||
Гражданство
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="u-table-body">
|
||||
@foreach (var item in Model.Item2)
|
||||
{
|
||||
<tr style="height: 75px">
|
||||
<td
|
||||
class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell">
|
||||
<input type="checkbox" class="form-check-input" name="dinner[]" value="@item.Id" id="@item.Id">
|
||||
</td>
|
||||
<td
|
||||
class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell"
|
||||
>
|
||||
@Html.DisplayFor(modelItem => item.DinnerName)
|
||||
</td>
|
||||
<td
|
||||
class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell"
|
||||
>
|
||||
@Html.DisplayFor(modelItem => item.DinnerPrice)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="u-align-right u-form-group u-form-submit u-label-top">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Добавить участников" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="u-container-layout u-container-layout-2">
|
||||
<input type="submit" value="Сохранить" class="btn btn-outline-dark text-center d-flex justify-content-md-center" />
|
||||
</div>
|
||||
</form>
|
@ -84,7 +84,7 @@
|
||||
asp-area="" asp-controller="Home" asp-action="AddDinnerToConferenceBooking"
|
||||
style="padding: 10 px"
|
||||
class="btn btn-outline-dark text-center d-flex justify-content-md-center"
|
||||
>Добавить обед</a>
|
||||
>Добавить обеды</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -9,7 +9,7 @@ namespace HotelDataBaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-VG5USAH\SQLEXPRESS;Initial Catalog=HotelDataBaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-V0ON61E\SQLEXPRESS;Initial Catalog=HotelDataBaseFu;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
@ -59,7 +59,6 @@ namespace HotelDataBaseImplement.Models
|
||||
public void Update(ConferenceBookingBindingModel model)
|
||||
{
|
||||
ConferenceId = model.ConferenceId;
|
||||
HeadwaiterId = model.HeadwaiterId;
|
||||
NameHall = model.NameHall;
|
||||
BookingDate = model.BookingDate;
|
||||
}
|
||||
@ -86,7 +85,7 @@ namespace HotelDataBaseImplement.Models
|
||||
|
||||
foreach (var updateDinner in conferenceBookingDinners)
|
||||
{
|
||||
model.ConferenceBookingDinners.Remove(updateDinner.Id);
|
||||
model.ConferenceBookingDinners.Remove(updateDinner.DinnerId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user