diff --git a/Hotel/HotelAdministratorApp/APIClient.cs b/Hotel/HotelAdministratorApp/APIClient.cs new file mode 100644 index 0000000..b1a605c --- /dev/null +++ b/Hotel/HotelAdministratorApp/APIClient.cs @@ -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(string requestUrl) + { + var response = _administrator.GetAsync(requestUrl); + var result = response.Result.Content.ReadAsStringAsync().Result; + if (response.Result.IsSuccessStatusCode) + { + return JsonConvert.DeserializeObject(result); + } + else + { + throw new Exception(result); + } + } + + public static void PostRequest(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); + } + } + } +} diff --git a/Hotel/HotelAdministratorApp/Controllers/HomeController.cs b/Hotel/HotelAdministratorApp/Controllers/HomeController.cs index 8022d89..829c064 100644 --- a/Hotel/HotelAdministratorApp/Controllers/HomeController.cs +++ b/Hotel/HotelAdministratorApp/Controllers/HomeController.cs @@ -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(); } diff --git a/Hotel/HotelAdministratorApp/HotelAdministratorApp.csproj b/Hotel/HotelAdministratorApp/HotelAdministratorApp.csproj index c78c9c7..c034399 100644 --- a/Hotel/HotelAdministratorApp/HotelAdministratorApp.csproj +++ b/Hotel/HotelAdministratorApp/HotelAdministratorApp.csproj @@ -6,4 +6,15 @@ enable + + + + + + + + + + + diff --git a/Hotel/HotelAdministratorApp/Program.cs b/Hotel/HotelAdministratorApp/Program.cs index 0727468..f45f5b8 100644 --- a/Hotel/HotelAdministratorApp/Program.cs +++ b/Hotel/HotelAdministratorApp/Program.cs @@ -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()) { diff --git a/Hotel/HotelAdministratorApp/Views/Home/AddDinnerRoomToFiles.cshtml b/Hotel/HotelAdministratorApp/Views/Home/AddDinnerRoomToFiles.cshtml new file mode 100644 index 0000000..ea9336f --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/AddDinnerRoomToFiles.cshtml @@ -0,0 +1,75 @@ +@{ + ViewData["Title"] = "AddDinnerRoomToFiles"; +} + + + +
+

Отчет (word/excel)

+
+
+
+ +
+ + +
+
+ + +
+
+ + + + + + + + + + +
+ Название + + Калорийность + + Цена +
+
+
+ +
+
\ No newline at end of file diff --git a/Hotel/HotelAdministratorApp/Views/Home/AddDinnerToFile.cshtml b/Hotel/HotelAdministratorApp/Views/Home/AddDinnerToFile.cshtml new file mode 100644 index 0000000..c1b7524 --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/AddDinnerToFile.cshtml @@ -0,0 +1,59 @@ +@{ + ViewData["Title"] = "AddDinnerToFile"; +} + + + + +
+

Отчет (pdf)

+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+ +
+ + +
+
+
+ +
+
+ +
+
+
\ No newline at end of file diff --git a/Hotel/HotelAdministratorApp/Views/Home/AddDinnerToRoom.cshtml b/Hotel/HotelAdministratorApp/Views/Home/AddDinnerToRoom.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/AddDinnerToRoom.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/Hotel/HotelAdministratorApp/Views/Home/AddNumberToMealPlan.cshtml b/Hotel/HotelAdministratorApp/Views/Home/AddNumberToMealPlan.cshtml new file mode 100644 index 0000000..93f956e --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/AddNumberToMealPlan.cshtml @@ -0,0 +1,52 @@ +@{ + ViewData["Title"] = "AddNumberToMealPlan"; +} + +
+

Привязка номера с планом питания

+
+
+
+ + +
+
+ + +
+
+ +
+
\ No newline at end of file diff --git a/Hotel/HotelAdministratorApp/Views/Home/ConferenceBookings.cshtml b/Hotel/HotelAdministratorApp/Views/Home/ConferenceBookings.cshtml new file mode 100644 index 0000000..5f2de2f --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/ConferenceBookings.cshtml @@ -0,0 +1,77 @@ +@{ + ViewData["Title"] = "ConferenceBookings"; +} + + + + +
+

Список броней по конференциям

+
+
+
+ + + + + + + + + + +
+ Номер + + Место конференции + + Дата брони +
+ +
+
\ No newline at end of file diff --git a/Hotel/HotelAdministratorApp/Views/Home/CreateDinner.cshtml b/Hotel/HotelAdministratorApp/Views/Home/CreateDinner.cshtml new file mode 100644 index 0000000..d983fa5 --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/CreateDinner.cshtml @@ -0,0 +1,43 @@ +@{ + ViewData["Title"] = "CreateDinner"; +} + +
+

Добавить обед

+
+
+ + + +
+ +
+ +
\ No newline at end of file diff --git a/Hotel/HotelAdministratorApp/Views/Home/CreateRoom.cshtml b/Hotel/HotelAdministratorApp/Views/Home/CreateRoom.cshtml new file mode 100644 index 0000000..eefcf9a --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/CreateRoom.cshtml @@ -0,0 +1,46 @@ +@{ + ViewData["Title"] = "CreateRoom"; +} + +
+

Добавить комнату

+
+
+ + + +
+ +
+ +
\ No newline at end of file diff --git a/Hotel/HotelAdministratorApp/Views/Home/DeleteDinner.cshtml b/Hotel/HotelAdministratorApp/Views/Home/DeleteDinner.cshtml new file mode 100644 index 0000000..5cba694 --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/DeleteDinner.cshtml @@ -0,0 +1,47 @@ +@{ + ViewData["Title"] = "DeleteDinner"; +} + +
+

Удалить обед

+
+
+
+ + +
+
+ +
+ +
\ No newline at end of file diff --git a/Hotel/HotelAdministratorApp/Views/Home/DeleteRoom.cshtml b/Hotel/HotelAdministratorApp/Views/Home/DeleteRoom.cshtml new file mode 100644 index 0000000..eb9494c --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/DeleteRoom.cshtml @@ -0,0 +1,47 @@ +@{ + ViewData["Title"] = "DeleteRoom"; +} + +
+

Удалить комнату

+
+
+
+ + +
+
+ +
+ +
\ No newline at end of file diff --git a/Hotel/HotelAdministratorApp/Views/Home/Dinners.cshtml b/Hotel/HotelAdministratorApp/Views/Home/Dinners.cshtml new file mode 100644 index 0000000..03e4f6d --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/Dinners.cshtml @@ -0,0 +1,76 @@ +@{ + ViewData["Title"] = "Dinners"; +} + + + + +
+

Список обедов

+
+
+
+ + + + + + + + + + + + +
+ Номер + + Название + + Калорийность + + Цена +
+ +
+
diff --git a/Hotel/HotelAdministratorApp/Views/Home/Enter.cshtml b/Hotel/HotelAdministratorApp/Views/Home/Enter.cshtml new file mode 100644 index 0000000..bafc7fb --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/Enter.cshtml @@ -0,0 +1,116 @@ +@{ + ViewData["Title"] = "Enter"; +} + + + +
+

Вход в приложение

+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+ Если у вас нет аккаунта то + + зарегестрируйтесь + +
+
+
+
+
diff --git a/Hotel/HotelAdministratorApp/Views/Home/Index.cshtml b/Hotel/HotelAdministratorApp/Views/Home/Index.cshtml index d2d19bd..2843700 100644 --- a/Hotel/HotelAdministratorApp/Views/Home/Index.cshtml +++ b/Hotel/HotelAdministratorApp/Views/Home/Index.cshtml @@ -1,8 +1,49 @@ @{ ViewData["Title"] = "Home Page"; } - -
-

Welcome

-

Learn about building Web apps with ASP.NET Core.

-
+ + + + +
+
+
+
+
+

+ Сайт администратора +

+

+ Здесь ты сможешь взаимодействовать c организатором, добавлять обеды, комнаты и бронь по конференциям +

+
+
+
+
+
diff --git a/Hotel/HotelAdministratorApp/Views/Home/Privacy.cshtml b/Hotel/HotelAdministratorApp/Views/Home/Privacy.cshtml index af4fb19..a421a83 100644 --- a/Hotel/HotelAdministratorApp/Views/Home/Privacy.cshtml +++ b/Hotel/HotelAdministratorApp/Views/Home/Privacy.cshtml @@ -1,6 +1,32 @@ -@{ - ViewData["Title"] = "Privacy Policy"; -} -

@ViewData["Title"]

+@using HotelContracts.ViewModels -

Use this page to detail your site's privacy policy.

+@model AdministratorViewModel + +@{ + ViewData["Title"] = "Privacy"; +} +
+

Личные данные

+
+
+
+
Логин:
+
+
+
+
Почта:
+
+
+
+
Пароль:
+
+
+
+
ФИО:
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/Hotel/HotelAdministratorApp/Views/Home/Register.cshtml b/Hotel/HotelAdministratorApp/Views/Home/Register.cshtml new file mode 100644 index 0000000..2edda3f --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/Register.cshtml @@ -0,0 +1,119 @@ +@{ + ViewData["Title"] = "Register"; +} + + + +
+

Регистрация в приложении

+
+
+
+
+
+
+
+

+ Введите все данные указанные ниже
+ для регистрации +

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
diff --git a/Hotel/HotelAdministratorApp/Views/Home/Rooms.cshtml b/Hotel/HotelAdministratorApp/Views/Home/Rooms.cshtml new file mode 100644 index 0000000..11a0d43 --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/Rooms.cshtml @@ -0,0 +1,80 @@ +@{ + ViewData["Title"] = "Rooms"; +} + + + + +
+

Список комнат

+
+
+
+ + + + + + + + + + + +
+ Номер + + Номер комнаты + + Кол. спальных мест + + Цена +
+ +
+
diff --git a/Hotel/HotelAdministratorApp/Views/Home/UpdateDinner.cshtml b/Hotel/HotelAdministratorApp/Views/Home/UpdateDinner.cshtml new file mode 100644 index 0000000..d2b4bd6 --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/UpdateDinner.cshtml @@ -0,0 +1,60 @@ +@{ + ViewData["Title"] = "UpdateDinner"; +} + +
+

Обновить обед

+
+
+
+ + +
+
+ +
+
+ +
+
+ +
+
+ +
+ +
\ No newline at end of file diff --git a/Hotel/HotelAdministratorApp/Views/Home/UpdateRoom.cshtml b/Hotel/HotelAdministratorApp/Views/Home/UpdateRoom.cshtml new file mode 100644 index 0000000..6894677 --- /dev/null +++ b/Hotel/HotelAdministratorApp/Views/Home/UpdateRoom.cshtml @@ -0,0 +1,93 @@ +@{ + ViewData["Title"] = "UpdateRoom"; +} + +
+

Обновить комнату

+
+
+
+ + +
+
+ +
+
+ +
+
+ +
+ + + + + + + + + + + + +
+ Номер + + Название + + Калорийность + + Цена +
+
+ +
+ + +
\ No newline at end of file diff --git a/Hotel/HotelAdministratorApp/Views/Shared/_Layout.cshtml b/Hotel/HotelAdministratorApp/Views/Shared/_Layout.cshtml index 3aa8eea..7c8e23e 100644 --- a/Hotel/HotelAdministratorApp/Views/Shared/_Layout.cshtml +++ b/Hotel/HotelAdministratorApp/Views/Shared/_Layout.cshtml @@ -3,28 +3,82 @@ - @ViewData["Title"] - HotelAdministratorApp + @ViewData["HotelAdmin"] - HotelAdministratorApp +