diff --git a/Hotel/HotelOrganiserApp/Controllers/HomeController.cs b/Hotel/HotelOrganiserApp/Controllers/HomeController.cs index 8806fd1..d0c5250 100644 --- a/Hotel/HotelOrganiserApp/Controllers/HomeController.cs +++ b/Hotel/HotelOrganiserApp/Controllers/HomeController.cs @@ -1,4 +1,6 @@ -using HotelOrganiserApp.Models; +using HotelContracts.BindingModels; +using HotelContracts.ViewModels; +using HotelOrganiserApp.Models; using Microsoft.AspNetCore.Mvc; using System.Diagnostics; @@ -15,6 +17,10 @@ namespace HotelOrganiserApp.Controllers public IActionResult Index() { + if (APIClient.Organiser == null) + { + return Redirect("~/Home/Enter"); + } return View(); } @@ -23,11 +29,47 @@ namespace HotelOrganiserApp.Controllers return View(); } + [HttpPost] + public void Register(string login, string email, string password, string surname, string name, string patronymic, string telephone) + { + if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(surname) || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(patronymic)) + { + throw new Exception("Введите логин, пароль, фамилию, имя и отчество"); + } + APIClient.PostRequest("api/organiser/register", new OrganiserBindingModel + { + OrganiserSurname = surname, + OrganiserName = name, + OrganiserPatronymic = patronymic, + OrganiserLogin = login, + OrganiserPassword = password, + OrganiserEmail = email, + OrganiserPhoneNumber = telephone + }); + + Response.Redirect("Enter"); + return; + } + public IActionResult Enter() { return View(); } + public void Enter(string login, string password) + { + if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password)) + { + throw new Exception("Введите логин и пароль"); + } + APIClient.Organiser = APIClient.GetRequest($"api/organiser/login?login={login}&password={password}"); + if (APIClient.Organiser == null) + { + throw new Exception("Неверный логин/пароль"); + } + Response.Redirect("Index"); + } + public IActionResult Report() { return View(); diff --git a/Hotel/HotelOrganiserApp/Views/Home/Enter.cshtml b/Hotel/HotelOrganiserApp/Views/Home/Enter.cshtml new file mode 100644 index 0000000..b6bf1a1 --- /dev/null +++ b/Hotel/HotelOrganiserApp/Views/Home/Enter.cshtml @@ -0,0 +1,39 @@ +@{ + ViewData["Title"] = "Enter"; +} + +
+
+
+
+
+
+
+
+

Вход

+
+
+ + +
+
+ + +
+
+
+ +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/Hotel/HotelOrganiserApp/Views/Home/Index.cshtml b/Hotel/HotelOrganiserApp/Views/Home/Index.cshtml index d2d19bd..2a047a1 100644 --- a/Hotel/HotelOrganiserApp/Views/Home/Index.cshtml +++ b/Hotel/HotelOrganiserApp/Views/Home/Index.cshtml @@ -3,6 +3,10 @@ }
-

Welcome

-

Learn about building Web apps with ASP.NET Core.

+
+
+

Hotel

+

Курсовая работа. Исполнитель

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

@ViewData["Title"]

+@using HotelContracts.ViewModels -

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

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

Мои данны

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

Регистрация

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/Hotel/HotelOrganiserApp/Views/Shared/_Layout.cshtml b/Hotel/HotelOrganiserApp/Views/Shared/_Layout.cshtml index 576c53e..0108d73 100644 --- a/Hotel/HotelOrganiserApp/Views/Shared/_Layout.cshtml +++ b/Hotel/HotelOrganiserApp/Views/Shared/_Layout.cshtml @@ -17,39 +17,42 @@ aria-expanded="false" aria-label="Toggle navigation"> -