почти доделал сайт администратора, а так же переделал рест апи

This commit is contained in:
Extrimal 2024-04-30 17:12:25 +04:00
parent c69db82f0f
commit 813ff90fe5
23 changed files with 1332 additions and 131 deletions

View File

@ -0,0 +1,49 @@
using HotelContracts.ViewModels;
using System.Net.Http.Headers;
using System.Text;
using Newtonsoft.Json;
namespace HotelAdministratorApp
{
public class APIClient
{
private static readonly HttpClient _administrator = new();
public static AdministratorViewModel? Administrator { get; set; } = null;
public static void Connect(IConfiguration configuration)
{
_administrator.BaseAddress = new Uri(configuration["IPAddress"]);
_administrator.DefaultRequestHeaders.Accept.Clear();
_administrator.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
public static T? GetRequest<T>(string requestUrl)
{
var response = _administrator.GetAsync(requestUrl);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (response.Result.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<T>(result);
}
else
{
throw new Exception(result);
}
}
public static void PostRequest<T>(string requestUrl, T model)
{
var json = JsonConvert.SerializeObject(model);
var data = new StringContent(json, Encoding.UTF8, "application/json");
var response = _administrator.PostAsync(requestUrl, data);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (!response.Result.IsSuccessStatusCode)
{
throw new Exception(result);
}
}
}
}

View File

@ -17,8 +17,73 @@ namespace HotelAdministratorApp.Controllers
{
return View();
}
public IActionResult Privacy()
public IActionResult Dinners()
{
return View();
}
public IActionResult Rooms()
{
return View();
}
public IActionResult ConferenceBookings()
{
return View();
}
public IActionResult ConferenceBookingToConference()
{
return View();
}
public IActionResult Privacy()
{
return View();
}
public IActionResult Register()
{
return View();
}
public IActionResult Enter()
{
return View();
}
public IActionResult AddDinnerRoomToFiles()
{
return View();
}
public IActionResult AddDinnerToFile()
{
return View();
}
public IActionResult CreateDinner()
{
return View();
}
public IActionResult UpdateDinner()
{
return View();
}
public IActionResult DeleteDinner()
{
return View();
}
public IActionResult CreateRoom()
{
return View();
}
public IActionResult UpdateRoom()
{
return View();
}
public IActionResult DeleteRoom()
{
return View();
}
public IActionResult AddDinnerToRoom()
{
return View();
}
public IActionResult AddNumberToMealPlan()
{
return View();
}

View File

@ -6,4 +6,15 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HotelBusinessLogic\HotelBusinessLogic.csproj" />
<ProjectReference Include="..\HotelContracts\HotelContracts.csproj" />
<ProjectReference Include="..\HotelDataBaseImplement\HotelDataBaseImplement.csproj" />
<ProjectReference Include="..\HotelDataModels\HotelDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -1,10 +1,11 @@
using HotelAdministratorApp;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
var app = builder.Build();
APIClient.Connect(builder.Configuration);
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{

View File

@ -0,0 +1,75 @@
@{
ViewData["Title"] = "AddDinnerRoomToFiles";
}
<head>
<style>
.buttons-create-file {
display: flex;
justify-content: center;
}
.button-action {
display: flex;
width: 130px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content: center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
}
.button-action:hover {
background-color: #D2D3D3;
color: #393939;
}
.table {
text-align: center;
}
.text-center {
margin-bottom: 30px;
}
</style>
</head>
<div class="text-center">
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1">Отчет (word/excel)</h2>
</div>
<form method="post">
<div class="file-format">
<label class="form-label">Формат файла:</label>
<div class="radio-buttons">
<input class="form-check-input" type="radio" name="type" id="docx">
<label class="label-word" for="docx">Word-файл</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="type" id="xlsx" checked>
<label class="label-exel" for="xlsx">Excel-файл</label>
</div>
</div>
<table class="table">
<thead>
<tr>
<th>
Название
</th>
<th>
Калорийность
</th>
<th>
Цена
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<br>
<div class="buttons-create-file">
<button class="button-action">Создать</button>
</div>
</form>

View File

@ -0,0 +1,59 @@
@{
ViewData["Title"] = "AddDinnerToFile";
}
<head>
<style>
.button-action {
display: flex;
width: 300px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content: center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
margin-bottom:10px;
}
.button-action:hover {
background-color: #D2D3D3;
color: #393939;
}
</style>
</head>
<div class="text-center">
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Отчет (pdf)</h2>
</div>
<form method="post">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="dateFrom" class="form-label text-custom-color-1">Начало периода:</label>
<input type="datetime-local" id="dateFrom" name="dateFrom" class="form-control" placeholder="Выберите дату начала периода">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="dateTo" class="form-label text-custom-color-1">Окончание периода:</label>
<input type="datetime-local" id="dateTo" name="dateTo" class="form-control" placeholder="Выберите дату окончания периода">
</div>
</div>
</div>
<div class="form-group mb-4">
<label for="headwaiterEmail" class="form-label text-custom-color-1">Введите почту:</label>
<input type="email" id="headwaiterEmail" name="headwaiterEmail" class="form-control" placeholder="Введите вашу почту">
</div>
<div class="buttons-action-with-files">
<div class="button">
<button class="button-action">На почту</button>
</div>
<div class="button">
<button class="button-action">Показать</button>
</div>
</div>
</form>

View File

@ -0,0 +1,5 @@
@*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}

View File

@ -0,0 +1,52 @@
@{
ViewData["Title"] = "AddNumberToMealPlan";
}
<style>
.text-center {
margin-bottom: 30px;
}
.button-action {
display: flex;
width: 300px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content: center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
margin-bottom: 10px;
}
input {
margin-bottom: 20px;
}
.button-action:hover {
background-color: #D2D3D3;
color: #393939;
}
.spisok {
margin-bottom: 20px;
}
</style>
<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="spisok">
<label class="u-label u-text-custom-color-1 u-label-1">Номер комнаты: </label>
<select class="form-control"></select>
</div>
<div class="spisok">
<label class="u-label u-text-custom-color-1 u-label-1">Название плана питания: </label>
<select class="form-control"></select>
</div>
<div class="button">
<button class="button-action">Добавить привязку</button>
</div>
</form>

View File

@ -0,0 +1,77 @@
@{
ViewData["Title"] = "ConferenceBookings";
}
<head>
<style>
.buttons-action-with-conferencebooking {
display: flex;
justify-content: space-between;
}
.button-action {
display: flex;
width: 130px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content: center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
}
.button-action:hover {
background-color: #D2D3D3;
color: #393939;
}
.table {
text-align: center;
}
.text-center {
margin-bottom: 30px;
}
</style>
</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="main">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Место конференции
</th>
<th>
Дата брони
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="buttons-action-with-conferencebooking">
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="CreateConferenceBooking" class="button-action">Добавить</a>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="UpdateConferenceBooking" class="button-action">Изменить</a>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="DeleteConferenceBooking" class="button-action">Удалить</a>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="AddDinnerToConferenceBooking" class="button-action">Добавить обед</a>
</div>
</div>
</div>
</form>

View File

@ -0,0 +1,43 @@
@{
ViewData["Title"] = "CreateDinner";
}
<style>
.text-center {
margin-bottom: 30px;
}
.button-action {
display: flex;
width: 300px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content: center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
margin-bottom: 10px;
}
input{
margin-bottom:20px;
}
.button-action:hover {
background-color: #D2D3D3;
color: #393939;
}
</style>
<div class="text-center">
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Добавить обед</h2>
</div>
<form method="post">
<input type="text" placeholder="Введите название обеда" class="form-control" />
<input type="text" placeholder="Введите калорийность обеда" class="form-control" />
<input type="number" placeholder="Введите стоимость обеда" class="form-control" step="1" />
<div class="button">
<button class="button-action">Сохранить</button>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="Dinners" class="button-action">Назад</a>
</div>
</form>

View File

@ -0,0 +1,46 @@
@{
ViewData["Title"] = "CreateRoom";
}
<style>
.text-center {
margin-bottom: 30px;
}
.button-action {
display: flex;
width: 300px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content: center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
margin-bottom: 10px;
}
input {
margin-bottom: 20px;
}
.button-action:hover {
background-color: #D2D3D3;
color: #393939;
}
</style>
<div class="text-center">
<h2 class="u-text u-text-custom-color-1 u-text-default u-text-1"> Добавить комнату</h2>
</div>
<form method="post">
<input type="text" placeholder="Введите название комнаты" class="form-control" />
<input type="number" placeholder="Введите кол. спальных мест" class="form-control" step="1" />
<input type="number" placeholder="Введите стоимость комнаты" class="form-control" step="1" />
<div class="button">
<button class="button-action">Сохранить</button>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="Rooms" class="button-action">Назад</a>
</div>
</form>

View File

@ -0,0 +1,47 @@
@{
ViewData["Title"] = "DeleteDinner";
}
<style>
.text-center {
margin-bottom: 30px;
}
.button-action {
display: flex;
width: 300px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content: center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
margin-bottom: 10px;
}
.button-action:hover {
background-color: #D2D3D3;
color: #393939;
}
.spisok {
margin-bottom: 20px;
}
</style>
<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="spisok">
<label class="u-label u-text-custom-color-1 u-label-1">Обеды: </label>
<select class="form-control"></select>
</div>
<div class="button">
<button class="button-action">Сохранить</button>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="Dinners" class="button-action">Назад</a>
</div>
</form>

View File

@ -0,0 +1,47 @@
@{
ViewData["Title"] = "DeleteRoom";
}
<style>
.text-center {
margin-bottom: 30px;
}
.button-action {
display: flex;
width: 300px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content: center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
margin-bottom: 10px;
}
.button-action:hover {
background-color: #D2D3D3;
color: #393939;
}
.spisok {
margin-bottom: 20px;
}
</style>
<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="spisok">
<label class="u-label u-text-custom-color-1 u-label-1">Комната: </label>
<select class="form-control"></select>
</div>
<div class="button">
<button class="button-action">Сохранить</button>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="Rooms" class="button-action">Назад</a>
</div>
</form>

View File

@ -0,0 +1,76 @@
@{
ViewData["Title"] = "Dinners";
}
<head>
<style>
.buttons-action-with-dinner {
display: flex;
justify-content: space-between;
}
.button-action{
display: flex;
width: 130px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content:center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
}
.button-action:hover{
background-color: #D2D3D3;
color: #393939;
}
.table{
text-align:center;
}
.text-center{
margin-bottom: 30px;
}
</style>
</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="main">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Название
</th>
<th>
Калорийность
</th>
<th>
Цена
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="buttons-action-with-dinner">
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="CreateDinner" class="button-action">Добавить</a>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="UpdateDinner" class="button-action">Изменить</a>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="DeleteDinner" class="button-action">Удалить</a>
</div>
</div>
</div>
</form>

View File

@ -0,0 +1,116 @@
@{
ViewData["Title"] = "Enter";
}
<head>
<style>
.main {
margin-top: 50px;
display: flex;
align-items: center;
justify-content: center;
}
.main_wrapper {
width: 430px;
display: flex;
justify-content: center;
text-align: center;
}
.main_block {
margin-top: 35px;
}
.main_fields {
margin-top: 18px;
}
input {
height: 53px;
width: 100%;
font-size: 20px;
line-height: 16px;
border: 1px solid #000000;
border-radius: 30px;
padding-left: 31px;
}
.main_field_one {
margin-bottom: 17px;
width: 100%;
}
.class_login {
width: 100%;
display: flex;
justify-content: center;
margin-top: 84px;
}
.button_login {
background-color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
width: 216px;
height: 39px;
border-radius: 30px;
border: 1px solid #000000;
font-size: 20px;
line-height: 39px;
transition: 0.2s ease;
cursor: pointer;
}
.button_login:hover {
background: #E3E3E3;
}
.down_word {
width: 100%;
margin-top: 23px;
font-size: 15px;
}
.word_registr {
text-decoration: none;
color: #18BDF1;
transition: color 0.2s ease;
}
.word_registr:hover {
color: #91F0FD;
}
</style>
</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="main">
<div class="main_wrapper">
<div class="main_block">
<div class="main_fields">
<div class="main_field_one">
<input type="text" placeholder="логин/почта">
</div>
<div class="main_field_two">
<input type="text" placeholder="пароль">
</div>
</div>
<div class="class_login">
<button class="button_login" type="submit">
Вход
</button>
</div>
<div class="down_word">
Если у вас нет аккаунта то
<a href="Register" class="word_registr">
зарегестрируйтесь
</a>
</div>
</div>
</div>
</div>
</form>

View File

@ -1,8 +1,49 @@
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>
<head>
<meta charset="UTF-8">
<style>
.main {
background-repeat: no-repeat;
background-size: cover;
width: 100%;
display: flex;
align-items: center;
margin-top: 124px;
}
.intro_wrapper{
display: flex;
justify-content: right;
min-height: 240px;
}
.intro_block {
width: 553px;
}
.intro_title {
font-size: 60px;
font-weight: 700;
margin: 0 0 29px 0;
}
.intro_text {
font-size: 20px;
margin: 0;
}
</style>
</head>
<form method="post">
<div class="main">
<div class="container-fluid">
<div class="intro_wrapper">
<div class="intro_block">
<h1 class="intro_title">
Сайт администратора
</h1>
<p class="intro_text">
Здесь ты сможешь взаимодействовать c организатором, добавлять обеды, комнаты и бронь по конференциям
</p>
</div>
</div>
</div>
</div>
</form>

View File

@ -1,6 +1,32 @@
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
@using HotelContracts.ViewModels
<p>Use this page to detail your site's privacy policy.</p>
@model AdministratorViewModel
@{
ViewData["Title"] = "Privacy";
}
<div class="text-center">
<h2 class="display-4">Личные данные</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Логин:</div>
<div class="col-8"><input type="text" name="login" /></div>
</div>
<div class="row">
<div class="col-4">Почта:</div>
<div class="col-8"><input type="text" name="email" /></div>
</div>
<div class="row">
<div class="col-4">Пароль:</div>
<div class="col-8"><input type="password" name="password" /></div>
</div>
<div class="row">
<div class="col-4">ФИО:</div>
<div class="col-8"><input type="text" name="fio" /></div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
</form>

View File

@ -0,0 +1,119 @@
@{
ViewData["Title"] = "Register";
}
<head>
<style>
.up_word {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 10px;
}
.main_text {
font-size: 17px;
}
.main {
display: flex;
align-items: center;
justify-content: center;
}
.main_wrapper {
width: 430px;
display: flex;
justify-content: center;
text-align: center;
}
.main_block {
margin-top: 20px;
}
.main_fields {
margin-top: 15px;
}
input {
height: 53px;
width: 100%;
font-size: 20px;
line-height: 16px;
border: 1px solid #000000;
border-radius: 30px;
padding-left: 31px;
}
.main_field {
margin-bottom: 10px;
width: 100%;
}
.class_login {
width: 100%;
display: flex;
justify-content: center;
margin-top: 55px;
}
.button_login {
background-color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
width: 216px;
height: 39px;
border-radius: 30px;
border: 1px solid #000000;
font-size: 20px;
line-height: 39px;
transition: 0.2s ease;
cursor: pointer;
}
.button_login:hover {
background: #E3E3E3;
}
</style>
</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="main">
<div class="main_wrapper">
<div class="main_block">
<div class="main_fields">
<div class="up_word">
<p class="main_text">
Введите все данные указанные ниже<br>
для регистрации
</p>
</div>
<div class="main_field">
<input type="text" placeholder="ФИО">
</div>
<div class="main_field">
<input type="text" placeholder="Логин">
</div>
<div class="main_field">
<input type="text" placeholder="Эл. почта">
</div>
<div class="main_field">
<input type="text" placeholder="Номер телефона">
</div>
<div class="main_field">
<input type="text" placeholder="Пароль">
</div>
</div>
<div class="class_login">
<button class="button_login" type="submit">
Регистрация
</button>
</div>
</div>
</div>
</div>
</form>

View File

@ -0,0 +1,80 @@
@{
ViewData["Title"] = "Rooms";
}
<head>
<style>
.buttons-action-with-room {
display: flex;
justify-content: space-between;
}
.button-action {
display: flex;
width: 130px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content: center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
}
.button-action:hover {
background-color: #D2D3D3;
color: #393939;
}
.table {
text-align: center;
}
.text-center {
margin-bottom: 30px;
}
</style>
</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="main">
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Номер комнаты
</th>
<th>
Кол. спальных мест
</th>
<th>
Цена
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="buttons-action-with-room">
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="CreateRoom" class="button-action">Добавить</a>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="UpdateRoom" class="button-action">Изменить</a>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="DeleteRoom" class="button-action">Удалить</a>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="AddDinnerToRoom" class="button-action">Добавить обед</a>
</div>
</div>
</div>
</form>

View File

@ -0,0 +1,60 @@
@{
ViewData["Title"] = "UpdateDinner";
}
<style>
.text-center {
margin-bottom: 30px;
}
.button-action {
display: flex;
width: 300px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content: center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
margin-bottom: 10px;
}
input {
margin-bottom: 20px;
}
.button-action:hover {
background-color: #D2D3D3;
color: #393939;
}
.spisok{
margin-bottom:20px;
}
</style>
<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="spisok">
<label class="u-label u-text-custom-color-1 u-label-1">Обеды: </label>
<select class="form-control"></select>
</div>
<div class="form-group">
<input type="text" placeholder="Введите название обеда" class="form-control" />
</div>
<div class="form-group">
<input type="text" placeholder="Введите калорийность обеда" class="form-control" />
</div>
<div class="form-group">
<input type="number" placeholder="Введите стоимость обеда" class="form-control" step="1" />
</div>
<div class="button">
<button class="button-action">Сохранить</button>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="Dinners" class="button-action">Назад</a>
</div>
</form>

View File

@ -0,0 +1,93 @@
@{
ViewData["Title"] = "UpdateRoom";
}
<style>
.text-center {
margin-bottom: 30px;
}
.button-action {
display: flex;
width: 300px;
height: 40px;
border-radius: 10px;
border: 1px solid #000000;
align-items: center;
justify-content: center;
background-color: #BDBDBD;
text-decoration: none;
color: #000000;
transition: 0.2s ease;
margin-bottom: 10px;
}
input {
margin-bottom: 20px;
}
.button-action:hover {
background-color: #D2D3D3;
color: #393939;
}
.spisok {
margin-bottom: 20px;
}
.word-dinner{
font-size: 25px;
display: flex;
justify-content:center;
}
.table {
text-align: center;
}
</style>
<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="spisok">
<label class="u-label u-text-custom-color-1 u-label-1">Комнаты: </label>
<select class="form-control"></select>
</div>
<div class="form-group">
<input type="text" placeholder="Введите номер комнаты" class="form-control" />
</div>
<div class="form-group">
<input type="number" placeholder="Введите кол. спальных мест" class="form-control" step="1" />
</div>
<div class="form-group">
<input type="number" placeholder="Введите стоимость комнаты" class="form-control" step="1" />
</div>
<label class="word-dinner">Обеды </label>
<table class="table">
<thead>
<tr>
<th>
Номер
</th>
<th>
Название
</th>
<th>
Калорийность
</th>
<th>
Цена
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="button">
<button class="button-action">Сохранить</button>
</div>
<div class="button">
<a asp-area="" asp-controller="Home" asp-action="Rooms" class="button-action">Назад</a>
</div>
</form>

View File

@ -3,28 +3,82 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - HotelAdministratorApp</title>
<title>@ViewData["HotelAdmin"] - HotelAdministratorApp</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/HotelAdministratorApp.styles.css" asp-append-version="true" />
<style>
body{
background-image: url('https://avatanplus.com/files/resources/original/5b65647d4d98f16504108986.jpg');
background-repeat: no-repeat;
background-size: cover;
}
.href-footer{
text-decoration:none;
}
</style>
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container-fluid">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">HotelAdministratorApp</a>
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">
<img src="https://thumbs.dreamstime.com/b/%D0%BC%D0%B8%D0%BD%D0%B8%D0%BC%D0%B0%D0%BB%D0%B8%D1%81%D1%82%D0%B8%D1%87%D0%BD%D1%8B%D0%B9-%D1%87%D0%B5%D1%80%D0%BD%D0%BE-%D0%B1%D0%B5%D0%BB%D1%8B%D0%B9-%D1%80%D0%B8%D1%81%D1%83%D0%BD%D0%BE%D0%BA-%D0%BE%D1%82%D0%B5%D0%BB%D1%8F-%D1%81%D0%B8%D0%BB%D1%83%D1%8D%D1%82-%D0%B7%D0%B4%D0%B0%D0%BD%D0%B8%D1%8F-%D0%B3%D0%BE%D1%81%D1%82%D0%B8%D0%BD%D0%B8%D1%86%D1%8B-%D0%B2-292394123.jpg"
alt="Описание изображения" width="60">
Hotel
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="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">
<div class="navbar-collapse collapse d-sm-inline-flex flex-smrow-reverse justify-content-end" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
<a class="nav-link" asparea="" asp-controller="Home" asp-action="Index">Главное меню</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Справочники
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li class="nav-item">
<a class="nav-link" asparea="" asp-controller="Home" asp-action="Dinners">Обеды</a>
</li>
<li class="nav-item">
<a class="nav-link" asparea="" asp-controller="Home" asp-action="Rooms">Комнаты</a>
</li>
<li class="nav-item">
<a class="nav-link" asparea="" asp-controller="Home" asp-action="ConferenceBookings">Бронь</a>
</li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Отчеты
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li class="nav-item">
<a class="nav-link" asparea="" asp-controller="Home" asp-action="AddDinnerRoomToFiles">Отчет (word/excel)</a>
</li>
<li class="nav-item">
<a class="nav-link" asparea="" asp-controller="Home" asp-action="AddDinnerToFile">Отчет (pdf) </a>
</li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
<a class="nav-link" asparea="" asp-controller="Home" asp-action="AddNumberToMealPlan">Привязка</a>
</li>
<li class="nav-item">
<a class="nav-link" asparea="" asp-controller="Home" asp-action="Privacy">Администратор</a>
</li>
<li class="nav-item">
<a class="nav-link" asparea="" asp-controller="Home" asp-action="Register">Регистрация</a>
</li>
<li class="nav-item">
<a class="nav-link" asparea="" asp-controller="Home" asp-action="Enter">Вход</a>
</li>
</ul>
</div>
</div>
@ -36,9 +90,9 @@
</main>
</div>
<footer class="border-top footer text-muted">
<footer class="bg-light border-top footer text-muted fixed-bottom">
<div class="container">
&copy; 2024 - HotelAdministratorApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
&copy; 2024 - Hotel - <a asp-area="" aspcontroller="Home" asp-action="Privacy" class="href-footer">Личные данные</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>

View File

@ -132,8 +132,6 @@ namespace HotelRestApi.Controllers
}
}
////////////////////////////////////////////////////////////////////////////////////////////
[HttpPost]
public void UpdateParticipant(ParticipantBindingModel model)
{
@ -193,7 +191,6 @@ namespace HotelRestApi.Controllers
}
}
/// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
[HttpPost]
public void UpdateDinner(DinnerBindingModel model)
{
@ -253,8 +250,6 @@ namespace HotelRestApi.Controllers
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
[HttpPost]
public void CreateConference(ConferenceBindingModel model)
{
@ -284,30 +279,23 @@ namespace HotelRestApi.Controllers
}
}
[HttpGet]
public (ConferenceViewModel, List<(string, string)>)? GetConference(int conferenceId)
{
try
{
var elem = _conference.ReadElement(new ConferenceSearchModel { Id = conferenceId });
if (elem == null)
return null;
var participants = new List<(string, string)>();
foreach (var participant in elem.ConferenceParticipants)
{
participants.Add((participant.Value.FIO, participant.Value.Number));
}
return (elem, participants);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error get conference by id={Id}", conferenceId);
throw;
}
}
[HttpPost]
[HttpGet]
public Tuple<ConferenceViewModel, List<Tuple<string, string>>>? GetConference(int conferenceId)
{
try
{
var elem = _conference.ReadElement(new ConferenceSearchModel { Id = conferenceId });
if (elem == null)
return null;
return Tuple.Create(elem, elem.ConferenceParticipants.Select(x => Tuple.Create(x.Value.ParticipantFIO, x.Value.Number)).ToList());
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения конференции по id={Id}", conferenceId);
throw;
}
}
[HttpPost]
public void DeleteConference(ConferenceBindingModel model)
{
try
@ -335,7 +323,6 @@ namespace HotelRestApi.Controllers
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[HttpPost]
public void CreateMealPlan(MealPlanBindingModel model)
@ -366,38 +353,24 @@ namespace HotelRestApi.Controllers
}
}
[HttpGet]
public (MealPlanViewModel, List<(string, string)>, List<(int, int)>)? GetMealPlan(int mealPlanId)
{
try
{
using var context = new HotelDataBase();
var elem = _mealPlan.ReadElement(new MealPlanSearchModel { Id = mealPlanId });
if (elem == null)
return null;
var participants = new List<(string, string)>();
foreach (var participant in elem.MealPlanParticipants)
{
participants.Add((participant.Value.FIO, participant.Value.Number));
}
var rooms = new List<(int, int)>();
foreach (var room in context.Rooms.Where(room => room.MealPlanId == elem.Id))
{
rooms.Add((room.RoomNumber, room.CountBeds));
}
return (elem, participants, rooms);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error get MealPlan by id={Id}", mealPlanId);
throw;
}
}
[HttpPost]
public Tuple<MealPlanViewModel, List<Tuple<string, string>>, List<Tuple<int, int>>>? GetMealPlan(int mealPlanId)
{
try
{
using var context = new HotelDataBase();
var elem = _mealPlan.ReadElement(new MealPlanSearchModel { Id = mealPlanId });
if (elem == null)
return null;
return Tuple.Create(elem, elem.MealPlanParticipants.Select(x => Tuple.Create(x.Value.ParticipantFIO, x.Value.Number)).ToList(), context.Rooms.Where(x => x.MealPlanId == elem.Id).Select(x => Tuple.Create(x.RoomNumber, x.CountBeds)).ToList());
}
catch (Exception ex)
{
_logger.LogError(ex, "Error get MealPlan by id={Id}", mealPlanId);
throw;
}
}
[HttpPost]
public void DeleteMealPlan(MealPlanBindingModel model)
{
try
@ -425,8 +398,6 @@ namespace HotelRestApi.Controllers
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
[HttpPost]
public void CreateRoom(RoomBindingModel model)
{
@ -454,29 +425,24 @@ namespace HotelRestApi.Controllers
throw;
}
}
[HttpGet]
public (RoomViewModel, List<(string, double)>)? GetRoom(int roomId)
{
try
{
var elem = _room.ReadElement(new RoomSearchModel { Id = roomId });
if (elem == null)
return null;
var dinners = new List<(string, double)>();
foreach (var dinner in elem.RoomDinners)
{
dinners.Add((dinner.Value.DinnerName, dinner.Value.DinnerPrice));
}
return (elem, dinners);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error get Room by id={Id}", roomId);
throw;
}
}
[HttpPost]
[HttpGet]
public Tuple<RoomViewModel, List<Tuple<string, double>>>? GetRoom(int roomId)
{
try
{
var elem = _room.ReadElement(new RoomSearchModel { Id = roomId });
if (elem == null)
return null;
return Tuple.Create(elem, elem.RoomDinners.Select(x => Tuple.Create(x.Value.DinnerName, x.Value.DinnerPrice)).ToList());
}
catch (Exception ex)
{
_logger.LogError(ex, "Error get Room by id={Id}", roomId);
throw;
}
}
[HttpPost]
public void DeleteRoom(RoomBindingModel model)
{
try
@ -503,7 +469,6 @@ namespace HotelRestApi.Controllers
throw;
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
[HttpPost]
public void CreateConferenceBooking(ConferenceBookingBindingModel model)
{
@ -533,30 +498,24 @@ namespace HotelRestApi.Controllers
}
}
[HttpGet]
public (ConferenceBookingViewModel, List<(string, double)>)? GetConferenceBooking(int conferenceBookingId)
{
try
{
[HttpGet]
public Tuple<ConferenceBookingViewModel, List<Tuple<string, double>>>? GetConferenceBooking(int conferenceBookingId)
{
try
{
var elem = _conferenceBooking.ReadElement(new ConferenceBookingSearchModel { Id = conferenceBookingId });
if (elem == null)
return null;
return Tuple.Create(elem, elem.ConferenceBookingDinners.Select(x => Tuple.Create(x.Value.DinnerName, x.Value.DinnerPrice)).ToList());
}
catch (Exception ex)
{
_logger.LogError(ex, "Error get ConferenceBooking by id={Id}", conferenceBookingId);
throw;
}
}
var elem = _conferenceBooking.ReadElement(new ConferenceBookingSearchModel { Id = conferenceBookingId });
if (elem == null)
return null;
var dinners = new List<(string, double)>();
foreach (var dinner in elem.ConferenceBookingDinners)
{
dinners.Add((dinner.Value.DinnerName, dinner.Value.DinnerPrice));
}
return (elem, dinners);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error get ConferenceBooking by id={Id}", conferenceBookingId);
throw;
}
}
[HttpPost]
[HttpPost]
public void DeleteConferenceBooking(ConferenceBookingBindingModel model)
{
try