From 3f4c0720e1e3421431e7baa20882a4a4512a7fab Mon Sep 17 00:00:00 2001 From: ivar Date: Sun, 19 Oct 2025 23:41:23 +0200 Subject: Initial --- src/Pages/App/Cabins.cshtml | 17 +++++++ src/Pages/App/Cabins.cshtml.cs | 14 ++++++ src/Pages/App/Index.cshtml | 22 +++++++++ src/Pages/App/Index.cshtml.cs | 12 +++++ src/Pages/App/Info.cshtml | 10 ++++ src/Pages/App/Info.cshtml.cs | 12 +++++ src/Pages/App/ReservationForm.cshtml | 88 +++++++++++++++++++++++++++++++++ src/Pages/App/ReservationForm.cshtml.cs | 24 +++++++++ src/Pages/App/Reservations.cshtml | 18 +++++++ src/Pages/App/Reservations.cshtml.cs | 12 +++++ src/Pages/App/Terms.cshtml | 10 ++++ src/Pages/App/Terms.cshtml.cs | 12 +++++ src/Pages/App/Users.cshtml | 11 +++++ src/Pages/App/Users.cshtml.cs | 14 ++++++ 14 files changed, 276 insertions(+) create mode 100644 src/Pages/App/Cabins.cshtml create mode 100644 src/Pages/App/Cabins.cshtml.cs create mode 100644 src/Pages/App/Index.cshtml create mode 100644 src/Pages/App/Index.cshtml.cs create mode 100644 src/Pages/App/Info.cshtml create mode 100644 src/Pages/App/Info.cshtml.cs create mode 100644 src/Pages/App/ReservationForm.cshtml create mode 100644 src/Pages/App/ReservationForm.cshtml.cs create mode 100644 src/Pages/App/Reservations.cshtml create mode 100644 src/Pages/App/Reservations.cshtml.cs create mode 100644 src/Pages/App/Terms.cshtml create mode 100644 src/Pages/App/Terms.cshtml.cs create mode 100644 src/Pages/App/Users.cshtml create mode 100644 src/Pages/App/Users.cshtml.cs (limited to 'src/Pages/App') diff --git a/src/Pages/App/Cabins.cshtml b/src/Pages/App/Cabins.cshtml new file mode 100644 index 0000000..7387151 --- /dev/null +++ b/src/Pages/App/Cabins.cshtml @@ -0,0 +1,17 @@ +@page +@model IOL.Fagprove.Pages.App.Cabins + +@{ + ViewData["Title"] = "Hytter"; +} + +
+
+ +@section Scripts +{ + +} \ No newline at end of file diff --git a/src/Pages/App/Cabins.cshtml.cs b/src/Pages/App/Cabins.cshtml.cs new file mode 100644 index 0000000..5a94c08 --- /dev/null +++ b/src/Pages/App/Cabins.cshtml.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Cabins : PageModel + { + public ActionResult OnGet() + { + if (!User.IsInRole("Administrator")) return Redirect("/app"); + return Page(); + } + } +} \ No newline at end of file diff --git a/src/Pages/App/Index.cshtml b/src/Pages/App/Index.cshtml new file mode 100644 index 0000000..0599255 --- /dev/null +++ b/src/Pages/App/Index.cshtml @@ -0,0 +1,22 @@ +@page +@using System.Security.Claims +@using IOL.Fagprove.Utilities +@model IOL.Fagprove.Pages.App.Index +@{ + ViewData["Title"] = "Hjem"; +} +
+

Hei @User.GetClaimValue(ClaimTypes.Name)

+ + Gå til reservasjonskjema + +
+

Her kommer en oversikt over dine reservasjoner.

+
+ +@section Scripts +{ + +} diff --git a/src/Pages/App/Index.cshtml.cs b/src/Pages/App/Index.cshtml.cs new file mode 100644 index 0000000..8f27af8 --- /dev/null +++ b/src/Pages/App/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Index : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/src/Pages/App/Info.cshtml b/src/Pages/App/Info.cshtml new file mode 100644 index 0000000..f4c1f3c --- /dev/null +++ b/src/Pages/App/Info.cshtml @@ -0,0 +1,10 @@ +@page +@model IOL.Fagprove.Pages.App.Info + +@{ + ViewData["Title"] = "Infoside"; +} +
+

Infoside

+

Her kommer det noe snart...

+
\ No newline at end of file diff --git a/src/Pages/App/Info.cshtml.cs b/src/Pages/App/Info.cshtml.cs new file mode 100644 index 0000000..541c090 --- /dev/null +++ b/src/Pages/App/Info.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Info : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/src/Pages/App/ReservationForm.cshtml b/src/Pages/App/ReservationForm.cshtml new file mode 100644 index 0000000..87df337 --- /dev/null +++ b/src/Pages/App/ReservationForm.cshtml @@ -0,0 +1,88 @@ +@page +@using IOL.Fagprove.Data +@using IOL.Fagprove.Utilities +@model IOL.Fagprove.Pages.App.ReservationForm +@{ + ViewData["Title"] = "Ny reservasjon"; +} + +
+

1. Velg hytten du vil reservere

+
+
+ @foreach (var field in StaticData.CabinFields.Where(field => Model.Cabins.Any(c => c.CategoryId == field.Id))) + { +

@field.Name

+
+ @foreach (var cabin in Model.Cabins.Where(c => c.CategoryId == field.Id)) + { +
+
+
+ @cabin.Name + +
+
+ @if (cabin.Capacity != null) + { + Sengeplasser: @cabin.Capacity + } + @if (cabin.Price.IsPresent()) + { + Pris per natt: @cabin.Price + } +
+ @if (cabin.Description.IsPresent()) + { +
@cabin.Description
+ } +
+
+ +
+
+ } +
+ } +
+
+ +
+
+ +@section Scripts +{ + +} diff --git a/src/Pages/App/ReservationForm.cshtml.cs b/src/Pages/App/ReservationForm.cshtml.cs new file mode 100644 index 0000000..e509a46 --- /dev/null +++ b/src/Pages/App/ReservationForm.cshtml.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Linq; +using IOL.Fagprove.Data; +using IOL.Fagprove.Data.Models; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class ReservationForm : PageModel + { + public List Cabins { get; set; } + private readonly AppDbContext _context; + + public ReservationForm(AppDbContext context) + { + _context = context; + } + + public void OnGet() + { + Cabins = _context.Cabins.ToList(); + } + } +} \ No newline at end of file diff --git a/src/Pages/App/Reservations.cshtml b/src/Pages/App/Reservations.cshtml new file mode 100644 index 0000000..867da6c --- /dev/null +++ b/src/Pages/App/Reservations.cshtml @@ -0,0 +1,18 @@ +@page +@model IOL.Fagprove.Pages.App.Reservations + +@{ + ViewData["Title"] = "Reservasjoner"; +} +
+
+ + +@section Scripts +{ + +} \ No newline at end of file diff --git a/src/Pages/App/Reservations.cshtml.cs b/src/Pages/App/Reservations.cshtml.cs new file mode 100644 index 0000000..62775e1 --- /dev/null +++ b/src/Pages/App/Reservations.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Reservations : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/src/Pages/App/Terms.cshtml b/src/Pages/App/Terms.cshtml new file mode 100644 index 0000000..e4d8449 --- /dev/null +++ b/src/Pages/App/Terms.cshtml @@ -0,0 +1,10 @@ +@page +@model IOL.Fagprove.Pages.App.Terms + +@{ + ViewData["Title"] = "Bruksvilkår"; +} +
+

Bruksvilkår

+

Her kommer det noe snart...

+
diff --git a/src/Pages/App/Terms.cshtml.cs b/src/Pages/App/Terms.cshtml.cs new file mode 100644 index 0000000..2f05cc1 --- /dev/null +++ b/src/Pages/App/Terms.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Terms : PageModel + { + public void OnGet() + { + + } + } +} \ No newline at end of file diff --git a/src/Pages/App/Users.cshtml b/src/Pages/App/Users.cshtml new file mode 100644 index 0000000..5a57e17 --- /dev/null +++ b/src/Pages/App/Users.cshtml @@ -0,0 +1,11 @@ +@page +@model IOL.Fagprove.Pages.App.Users + +@{ + ViewData["Title"] = "Brukere"; +} +
+@section Scripts +{ + +} diff --git a/src/Pages/App/Users.cshtml.cs b/src/Pages/App/Users.cshtml.cs new file mode 100644 index 0000000..e7a1ceb --- /dev/null +++ b/src/Pages/App/Users.cshtml.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Users : PageModel + { + public ActionResult OnGet() + { + if (!User.IsInRole("Administrator")) return Redirect("/app"); + return Page(); + } + } +} \ No newline at end of file -- cgit v1.3