diff --git a/TicketOffice/Pages/Auth/Login.cshtml b/TicketOffice/Pages/Auth/Login.cshtml new file mode 100644 index 0000000..26666d9 --- /dev/null +++ b/TicketOffice/Pages/Auth/Login.cshtml @@ -0,0 +1,32 @@ +@page +@model TicketOffice.Pages.Auth.LoginModel + +@{ + Layout = "~/Pages/Shared/_Layout.cshtml"; + ViewData["Title"] = "Авторизація"; +} + + + +
+
+
+ Авторизація +
+ + + +
+ + + +
+ + + +
+ Не маєте аккаунта? + Зареєструватись +
+
+
\ No newline at end of file diff --git a/TicketOffice/Pages/Auth/Login.cshtml.cs b/TicketOffice/Pages/Auth/Login.cshtml.cs new file mode 100644 index 0000000..9fe29b6 --- /dev/null +++ b/TicketOffice/Pages/Auth/Login.cshtml.cs @@ -0,0 +1,30 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using TicketOffice.Data; +using TicketOffice.Models; + +namespace TicketOffice.Pages.Auth; + +public class LoginModel : PageModel +{ + private readonly TicketOfficeContext _context; + + public LoginModel(TicketOfficeContext context) + { + _context = context; + } + + public IActionResult OnGet() + { + return Page(); + } + + [BindProperty] + public User User { get; set; } + + public async Task OnPostAsync() + { + //Login logic + return Page(); + } +} \ No newline at end of file diff --git a/TicketOffice/Pages/Auth/Registration.cshtml b/TicketOffice/Pages/Auth/Registration.cshtml new file mode 100644 index 0000000..48481fb --- /dev/null +++ b/TicketOffice/Pages/Auth/Registration.cshtml @@ -0,0 +1,32 @@ +@page +@model TicketOffice.Pages.Auth.RegistrationModel + +@{ + Layout = "~/Pages/Shared/_Layout.cshtml"; + ViewData["Title"] = "Реєстрація"; +} + + + +
+
+
+ Реєстрація +
+ + + +
+ + + +
+ + + +
+ Вже маєте аккаунт? + Авторизуватись +
+
+
\ No newline at end of file diff --git a/TicketOffice/Pages/Auth/Registration.cshtml.cs b/TicketOffice/Pages/Auth/Registration.cshtml.cs new file mode 100644 index 0000000..683c334 --- /dev/null +++ b/TicketOffice/Pages/Auth/Registration.cshtml.cs @@ -0,0 +1,37 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using TicketOffice.Data; +using TicketOffice.Models; + +namespace TicketOffice.Pages.Auth; + +public class RegistrationModel : PageModel +{ + private readonly TicketOfficeContext _context; + + public RegistrationModel(TicketOfficeContext context) + { + _context = context; + } + + public IActionResult OnGet() + { + return Page(); + } + + [BindProperty] + public User User { get; set; } + + public async Task OnPostAsync() + { + if (!ModelState.IsValid) + { + return Page(); + } + + _context.User.Add(User); + await _context.SaveChangesAsync(); + + return RedirectToPage("./"); + } +} \ No newline at end of file diff --git a/TicketOffice/Pages/Index.cshtml b/TicketOffice/Pages/Index.cshtml index c6be329..50fa2cc 100644 --- a/TicketOffice/Pages/Index.cshtml +++ b/TicketOffice/Pages/Index.cshtml @@ -4,11 +4,3 @@ ViewData["Title"] = "Home page"; } - - diff --git a/TicketOffice/Pages/Index.cshtml.cs b/TicketOffice/Pages/Index.cshtml.cs index 9f3ec35..2fc1733 100644 --- a/TicketOffice/Pages/Index.cshtml.cs +++ b/TicketOffice/Pages/Index.cshtml.cs @@ -1,14 +1,37 @@ -using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using TicketOffice.Data; +using TicketOffice.Models; namespace TicketOffice.Pages; public class IndexModel : PageModel { - public IndexModel() + private readonly TicketOfficeContext _context; + + public IndexModel(TicketOfficeContext context) { + _context = context; } - public void OnGet() + public IActionResult OnGet() { + return Page(); + } + + [BindProperty] + public User User { get; set; } + + public async Task OnPostAsync() + { + if (!ModelState.IsValid) + { + return Page(); + } + + _context.User.Add(User); + await _context.SaveChangesAsync(); + + return RedirectToPage("./Routes"); } } \ No newline at end of file diff --git a/TicketOffice/Pages/Routes/Index.cshtml b/TicketOffice/Pages/Routes/Index.cshtml index a504ec2..61e9906 100644 --- a/TicketOffice/Pages/Routes/Index.cshtml +++ b/TicketOffice/Pages/Routes/Index.cshtml @@ -11,14 +11,6 @@ - -
diff --git a/TicketOffice/Pages/Shared/_Layout.cshtml b/TicketOffice/Pages/Shared/_Layout.cshtml index 5fdfe2a..eabffe1 100644 --- a/TicketOffice/Pages/Shared/_Layout.cshtml +++ b/TicketOffice/Pages/Shared/_Layout.cshtml @@ -14,6 +14,17 @@ +
+ @{ + string path = @Model.Request.Path.ToString(); + } + + Головна + Пошук маршрутів + +
@RenderBody() diff --git a/TicketOffice/Program.cs b/TicketOffice/Program.cs index 0bc60f0..10f2e7c 100644 --- a/TicketOffice/Program.cs +++ b/TicketOffice/Program.cs @@ -1,5 +1,4 @@ using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; using TicketOffice.Data; using TicketOffice.Models; @@ -25,12 +24,11 @@ if (!app.Environment.IsDevelopment()) app.UseHsts(); } -app.UseHttpsRedirection(); app.UseStaticFiles(); -app.UseRouting(); +app.UseHttpsRedirection(); -app.UseAuthorization(); +app.UseRouting(); app.MapRazorPages(); diff --git a/TicketOffice/TicketOffice.csproj b/TicketOffice/TicketOffice.csproj index 06c09ef..25e26a1 100644 --- a/TicketOffice/TicketOffice.csproj +++ b/TicketOffice/TicketOffice.csproj @@ -30,4 +30,9 @@ + + <_ContentIncludedByDefault Remove="Pages\Auth\Registration\Index.cshtml" /> + <_ContentIncludedByDefault Remove="Pages\Auth\Login\Index.cshtml" /> + + diff --git a/TicketOffice/wwwroot/css/Auth.css b/TicketOffice/wwwroot/css/Auth.css new file mode 100644 index 0000000..772a6c2 --- /dev/null +++ b/TicketOffice/wwwroot/css/Auth.css @@ -0,0 +1,80 @@ +html { + font-size: 16px; + min-height: 100%; + font-family: 'Roboto', sans-serif; + font-weight: 700; + background-color: #eaeef1; +} + +body { + margin: 0; +} + +.wrapper { + width: 50rem; + margin: 1.5rem auto; + padding: 3rem 0; + border-radius: 0.5rem; + box-shadow: 0 1px 2.4rem 0 #c3c9d0; + text-align: center; +} + +.header { + margin-bottom: 1.5rem; + font-size: 1.75rem; +} + +input.field { + font-family: 'Roboto', sans-serif; + font-size: 1.25rem; + font-weight: 700; + color: #262626; + line-height: 4.7rem; + width: 30rem; + height: 3rem; + box-sizing: border-box; + background: white; + border: 0.1rem solid #b8bfc7; + box-shadow: 0 1px 0 0 #fff; + border-radius: .3rem; + padding: 0 1.1rem; + margin-bottom: 1rem; + text-align: left; +} + +input.field:focus { + outline: 0; + border-color: #68b2dd; + background-color: #fff; +} + +input.submit-btn { + color: #1d4965; + font-size: 1.4rem; + font-weight: 700; + line-height: 3rem; + padding: 0 1.5rem; + background: linear-gradient(0deg,#79b6db,#b3dbf2); + border: none; + border-radius: .3rem; + cursor: pointer; +} + +.hint { + margin-top: 1.5rem; + color: #777a7e; +} + +input[type=submit]:hover { + opacity: 0.8; +} + +.link { + color: #245c78; + text-decoration: none; + cursor: pointer; +} + +.link:hover { + text-decoration: underline; +} \ No newline at end of file diff --git a/TicketOffice/wwwroot/db/TicketOffice-SQLite.db b/TicketOffice/wwwroot/db/TicketOffice-SQLite.db index 5e4ed18..0d697ea 100644 Binary files a/TicketOffice/wwwroot/db/TicketOffice-SQLite.db and b/TicketOffice/wwwroot/db/TicketOffice-SQLite.db differ