This commit is contained in:
AnnZhimol 2023-05-16 18:24:44 +04:00
commit 482dd619e6
14 changed files with 361 additions and 164 deletions

View File

@ -0,0 +1,30 @@
@{
ViewData["Title"] = "CreateMember";
}
<form method="post">
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Название обеда</label>
</div>
<input
type="text"
placeholder="Введите название обеда"
name="dinnerName"
class="form-control"
/>
<br>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-2">Стоимость обеда</label>
</div>
<input
type="number"
placeholder="Введите стоимость обеда"
name="dinnerPrice"
class="form-control"
step="1"
/>
<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>

View File

@ -0,0 +1,18 @@
@{
ViewData["Title"] = "DeleteDinner";
}
<form method="post">
<div class="container d-flex justify-content-center align-items-center0">
<div class="card-body">
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Обеды: </label>
<select id="dinner" name="dinner" class="form-control" asp-items="@(new SelectList(@ViewBag.Dinners, "Id", "DinnerName"))"></select>
</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>
</div>
</div>
</form>

View File

@ -12,24 +12,30 @@
</h2>
</div>
<form method="post">
<div class="u-form-group u-label-top u-form-group-1">
<label class="u-label u-text-custom-color-1 u-label-1">Электронная почта</label>
<input
type="text"
placeholder="Введите свой логин"
name="login"
class="u-input u-input-rectangle u-input-1"/>
</div>
<div class="u-form-group u-label-top u-form-group-2">
<label class="u-label u-text-custom-color-1 u-label-2">Пароль</label>
<input
type="password"
placeholder="Введите свой пароль"
name="password"
class="u-input u-input-rectangle u-input-2"/>
</div>
<div class="u-align-center 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>
<div class="container d-flex justify-content-center align-items-center">
<div class="card-body">
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Электронная почта</label>
<input
type="text"
placeholder="Введите свой логин"
name="login"
class="form-control"
/>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-2">Пароль</label>
<input
type="password"
placeholder="Введите свой пароль"
name="password"
class="form-control"
/>
</div>
<br>
<div class="form-group text-center" style="padding-bottom: 120px;">
<button type="submit" class="btn btn-outline-dark text-center d-flex justify-content-md-center">Войти</button>
</div>
</div>
</div>
</form>

View File

@ -7,44 +7,52 @@
ViewData["Title"] = "Home Page";
}
<html lang="en">
<head>
<link rel="stylesheet" href="~/css/mainpage.css" asp-append-version="true" />
<meta charset="UTF-8">
<title>Bootstrap Card</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<style>
body {
background-size: cover;
background-position: center center;
height: 100vh;
}
.card {
margin: 100px auto;
width: 50%;
background-color: rgba(255, 255, 255, 0.8);
border-radius: 10px;
}
.card-header {
border-radius: 10px 10px 0 0;
background-color: #343A40;
color: #fff;
border: 0;
}
.card-title {
font-weight: bold;
}
.card-text {
font-size: 1.25rem;
padding: 20px;
}
</style>
</head>
<section class="u-clearfix u-section-1" id="sec-83a8">
<div class="u-clearfix u-sheet u-sheet-1">
<div class="u-clearfix u-expanded-width u-layout-wrap u-layout-wrap-1">
<div class="u-layout">
<div class="u-layout-col">
<div
class="u-container-style u-layout-cell u-size-30 u-layout-cell-1"
>
<div
class="u-container-layout u-valign-bottom u-container-layout-1"
>
<h2
class="u-align-center u-text u-text-custom-color-1 u-text-default u-text-1"
>
Гостиница
</h2>
</div>
</div>
<div
class="u-container-style u-layout-cell u-size-30 u-layout-cell-2"
>
<div
class="u-container-layout u-valign-top u-container-layout-2"
style="padding: 120px"
>
<img
class="u-image u-image-contain u-image-1"
src="~/Images/logo.png"
data-image-width="2388"
data-image-height="1260"
/>
</div>
</div>
</div>
<body class="bg-image">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h5 class="card-title">Отель</h5>
</div>
<div class="card-body">
<p class="card-text">Создатель Кашин Максим и Жимолостнова Анна</p>
</div>
</div>
</div>
</section>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,80 @@
@using HotelContracts.ViewModels
@model List<DinnerViewModel>
@{
ViewData["Title"] = "ListDinners";
}
<section class="u-clearfix u-section-1" id="sec-e38b">
<div class="u-clearfix u-sheet u-sheet-1">
<div class="u-clearfix u-layout-wrap u-layout-wrap-1">
<div class="u-layout">
<div class="u-layout-row">
<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="table">
<thead class="thead-dark">
<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){
<tr style="height: 75px">
<td
class="u-border-1 u-border-grey-40 u-border-no-left u-border-no-right u-table-cell">
@Html.DisplayFor(modelItem => 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.DinnerPrice)
</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>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
<div
class="u-container-style u-layout-cell u-size-12 u-layout-cell-2"
>
<div class="u-container-layout u-container-layout-2">
<a
asp-area="" asp-controller="Home" asp-action="CreateDinner"
class="btn btn-outline-dark text-center d-flex justify-content-md-center"
>Добавить</a>
&nbsp;
<a
asp-area="" asp-controller="Home" asp-action="UpdateDinner"
class="btn btn-outline-dark text-center d-flex justify-content-md-center"
>Изменить</a>
&nbsp;
<a
asp-area="" asp-controller="Home" asp-action="DeleteDinner"
class="btn btn-outline-dark text-center d-flex justify-content-md-center"
>Удалить</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>

View File

@ -1,25 +0,0 @@

@{
ViewData["Title"] = "ListOfMealPlans";
}
<div class="text-center">
<h1 class="display-4">Заказы</h1>
</div>
<form method="post">
<div class="form-group">
<label for="exampleFormControlSelect2">Доступный для выбора обед</label>
<select multiple class="form-control" id="exampleFormControlSelect2">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<button type="button" class="btn btn-lg btn-primary" disabled>Word</button>
<button type="button" class="btn btn-lg btn-primary" disabled>Excel</button>
<button type="button" class="btn btn-secondary btn-lg" disabled>Отмена</button>
</form>

View File

@ -1,56 +1,61 @@
@{
ViewData["Title"] = "Register";
}
<head>
<link rel="stylesheet" href="~/css/register.css" asp-append-version="true" />
</head>
<div class="text-center">
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Регистрация </h2>
</div>
<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>
<input
type="text"
placeholder="Введите логин"
name="login"
class="u-input u-input-rectangle"/>
</div>
<div class="u-form-email u-form-group u-label-top">
<label class="u-label u-text-custom-color-1 u-label-2">Электронная почта</label>
<input
type="email"
placeholder="Введите электронную почту"
name="email"
class="u-input u-input-rectangle"/>
</div>
<div class="u-form-group u-label-top u-form-group-3">
<label class="u-label u-text-custom-color-1 u-label-3">ФИО</label>
<input
type="text"
placeholder="Введите ФИО"
name="fio"
class="u-input u-input-rectangle"/>
</div>
<div class="u-form-group u-label-top u-form-group-4">
<label class="u-label u-text-custom-color-1 u-label-4">Номер телефона</label>
<input
type="text"
name="telephone"
class="u-input u-input-rectangle"
placeholder="Введите номер телефона"/>
</div>
<div class="u-form-group u-label-top u-form-group-5">
<label class="u-label u-text-custom-color-1 u-label-5">Пароль</label>
<input
type="password"
placeholder="Введите пароль"
name="password"
class="u-input u-input-rectangle"/>
</div>
<div class="u-align-center u-form-group u-form-submit u-label-top"
style="padding: 120px">
<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>
<div class="container d-flex justify-content-center align-items-center">
<div class="card-body">
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Логин</label>
<input
type="text"
placeholder="Введите логин"
name="login"
class="form-control"
/>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-2">Электронная почта</label>
<input
type="email"
placeholder="Введите электронную почту"
name="email"
class="form-control"
/>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-3">ФИО</label>
<input
type="text"
placeholder="Введите ФИО"
name="fio"
class="form-control"
/>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-4">Номер телефона</label>
<input
type="text"
name="telephone"
class="form-control"
placeholder="Введите номер телефона"
/>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-5">Пароль</label>
<input
type="password"
placeholder="Введите пароль"
name="password"
class="form-control"
/>
</div>
<br>
<div class="form-group text-center" style="padding-bottom: 120px;">
<button type="submit" class="btn btn-outline-dark text-center d-flex justify-content-md-center">Зарегистрироваться</button>
</div>
</div>
</div>
</form>

View File

@ -0,0 +1,71 @@
@using HotelContracts.ViewModels;
@using HotelDataModels.Models;
@{
ViewData["Title"] = "UpdateDinner";
}
<head>
<link rel="stylesheet" href="~/css/createdinner.css" asp-append-version="true" />
</head>
<form method="post">
<div class="container d-flex justify-content-center align-items-center">
<div class="card-body">
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Обеды: </label>
<select id="dinner" name="dinner" class="form-control" asp-items="@(new SelectList(@ViewBag.Dinners, "Id", "DinnerName"))"></select>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-1">Название обеда</label>
<input
type="text"
id="dinnerName"
placeholder="Введите название обеда"
name="dinnerName"
class="form-control"
/>
</div>
<div class="form-group">
<label class="u-label u-text-custom-color-1 u-label-2">Стоимость обеда</label>
<input
type="number"
id="dinnerPrice"
placeholder="Введите стоимость обеда"
name="dinnerPrice"
class="form-control"
step="1"
/>
</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>
</div>
</div>
</form>
@section Scripts
{
<script>
function check() {
var dinner = $('#dinner').val();
if (dinner) {
$.ajax({
method: "GET",
url: "/Home/GetDinner",
data: { dinnerId: dinner },
success: function (result) {
$('#dinnerName').val(result.DinnerName);
$('#dinnerPrice').val(result.DinnerPrice);
}
});
};
}
check();
$('#dinner').on('change', function () {
check();
});
</script>
}

View File

@ -27,7 +27,7 @@
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="Index">Главное меню</a>
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="FormationDinner">Обед</a>
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="ListDinners">Обеды</a>
<a class="nav-link " asp-area="" asp-controller="Home" asp-action="ShapingDinnerIntoRooms">Комната</a>

View File

@ -15,4 +15,5 @@ html {
body {
margin-bottom: 60px;
}
}

View File

@ -44,7 +44,7 @@ namespace HotelDataBaseImplement.Implemets
return context.ConferenceBookings
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.RoomDinners)
.ThenInclude(x => x.RoomDinner)
.ThenInclude(x => x.Room)
.Include(x => x.Conference)
.Include(x => x.Headwaiter)
@ -65,7 +65,7 @@ namespace HotelDataBaseImplement.Implemets
return context.ConferenceBookings
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.RoomDinners)
.ThenInclude(x => x.RoomDinner)
.ThenInclude(x => x.Room)
.Include(x => x.Conference)
.Include(x => x.Headwaiter)
@ -77,7 +77,7 @@ namespace HotelDataBaseImplement.Implemets
return context.ConferenceBookings
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.RoomDinners)
.ThenInclude(x => x.RoomDinner)
.ThenInclude(x => x.Room)
.Include(x => x.Conference)
.Include(x => x.Headwaiter)
@ -88,7 +88,7 @@ namespace HotelDataBaseImplement.Implemets
return context.ConferenceBookings
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.RoomDinners)
.ThenInclude(x => x.RoomDinner)
.ThenInclude(x => x.Room)
.Include(x => x.Conference)
.Include(x => x.Headwaiter)
@ -104,7 +104,7 @@ namespace HotelDataBaseImplement.Implemets
return context.ConferenceBookings
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.RoomDinners)
.ThenInclude(x => x.RoomDinner)
.ThenInclude(x => x.Room)
.Include(x => x.Conference)
.Include(x => x.Headwaiter)
@ -128,7 +128,7 @@ namespace HotelDataBaseImplement.Implemets
return context.ConferenceBookings
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.RoomDinners)
.ThenInclude(x => x.RoomDinner)
.ThenInclude(x => x.Room)
.Include(x => x.Conference)
.Include(x => x.Headwaiter)
@ -144,7 +144,7 @@ namespace HotelDataBaseImplement.Implemets
var conferenceBooking = context.ConferenceBookings
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.RoomDinners)
.ThenInclude(x => x.RoomDinner)
.ThenInclude(x => x.Room)
.Include(x => x.Conference)
.Include(x => x.Headwaiter)

View File

@ -41,9 +41,9 @@ namespace HotelDataBaseImplement.Implemets
using var context = new HotelDataBase();
return context.Dinners
.Include(x => x.RoomDinners)
.Include(x => x.RoomDinner)
.ThenInclude(x => x.Room)
.Include(x => x.ConferenceBookingDinners)
.Include(x => x.ConferenceBookingDinner)
.ThenInclude(x => x.ConferenceBooking)
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.DinnerName) && x.DinnerName == model.DinnerName) || (model.Id.HasValue && x.Id == model.Id))?
.GetViewModel;
@ -61,21 +61,23 @@ namespace HotelDataBaseImplement.Implemets
if (model.HeadwaiterId.HasValue)
{
return context.Dinners
.Include(x => x.RoomDinners)
.ThenInclude(x => x.Room)
.Include(x => x.ConferenceBookingDinners)
.ThenInclude(x => x.ConferenceBooking)
.Where(x => x.DinnerName.Contains(model.DinnerName))
.ToList()
.Select(x => x.GetViewModel)
.ToList();
.Include(x => x.RoomDinner)
.ThenInclude(x => x.Room)
.Include(x => x.ConferenceBookingDinner)
.ThenInclude(x => x.ConferenceBooking)
.Include(x => x.Headwaiter)
.Where(x => x.HeadwaiterId == model.HeadwaiterId)
.ToList()
.Select(x => x.GetViewModel)
.ToList();
}
return context.Dinners
.Include(x => x.RoomDinners)
.Include(x => x.RoomDinner)
.ThenInclude(x => x.Room)
.Include(x => x.ConferenceBookingDinners)
.Include(x => x.ConferenceBookingDinner)
.ThenInclude(x => x.ConferenceBooking)
.Include(x => x.Headwaiter)
.Where(x => x.DinnerName.Contains(model.DinnerName))
.ToList()
.Select(x => x.GetViewModel)
@ -87,13 +89,14 @@ namespace HotelDataBaseImplement.Implemets
using var context = new HotelDataBase();
return context.Dinners
.Include(x => x.RoomDinners)
.ThenInclude(x => x.Room)
.Include(x => x.ConferenceBookingDinners)
.ThenInclude(x => x.ConferenceBooking)
.ToList()
.Select(x => x.GetViewModel)
.ToList();
.Include(x => x.RoomDinner)
.ThenInclude(x => x.Room)
.Include(x => x.ConferenceBookingDinner)
.ThenInclude(x => x.ConferenceBooking)
.Include(x => x.Headwaiter)
.ToList()
.Select(x => x.GetViewModel)
.ToList();
}
public DinnerViewModel? Insert(DinnerBindingModel model)

View File

@ -46,7 +46,7 @@ namespace HotelDataBaseImplement.Implemets
return context.Rooms
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.ConferenceBookingDinners)
.ThenInclude(x => x.ConferenceBookingDinner)
.ThenInclude(x => x.ConferenceBooking)
.Include(x => x.MealPlan)
.Include(x => x.Headwaiter)
@ -57,7 +57,7 @@ namespace HotelDataBaseImplement.Implemets
return context.Rooms
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.ConferenceBookingDinners)
.ThenInclude(x => x.ConferenceBookingDinner)
.ThenInclude(x => x.ConferenceBooking)
.Include(x => x.MealPlan)
.Include(x => x.Headwaiter)
@ -77,7 +77,7 @@ namespace HotelDataBaseImplement.Implemets
return context.Rooms
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.ConferenceBookingDinners)
.ThenInclude(x => x.ConferenceBookingDinner)
.ThenInclude(x => x.ConferenceBooking)
.Include(x => x.MealPlan)
.Include(x => x.Headwaiter)
@ -92,7 +92,7 @@ namespace HotelDataBaseImplement.Implemets
return context.Rooms
.Include(x => x.Dinners)
.ThenInclude(x => x.Dinner)
.ThenInclude(x => x.ConferenceBookingDinners)
.ThenInclude(x => x.ConferenceBookingDinner)
.ThenInclude(x => x.ConferenceBooking)
.Include(x => x.MealPlan)
.Include(x => x.Headwaiter)

View File

@ -22,13 +22,13 @@ namespace HotelDataBaseImplement.Models
[Required]
public double DinnerPrice { get; set; }
public virtual Headwaiter Headwaiters { get; set; }
public virtual Headwaiter Headwaiter { get; set; }
[ForeignKey("DinnerId")]
public virtual List<RoomDinner> RoomDinners { get; set; }
public virtual List<RoomDinner> RoomDinner { get; set; }
[ForeignKey("DinnercId")]
public virtual List<ConferenceBookingDinner> ConferenceBookingDinners { get; set; }
public virtual List<ConferenceBookingDinner> ConferenceBookingDinner { get; set; }
public static Dinner? Create(DinnerBindingModel model)
{
if (model == null)