source: Application/ocrent/Views/Shared/_Layout.cshtml

Last change on this file was f5f7c24, checked in by 192011 <mk.snicker@…>, 17 months ago

Initial commit

  • Property mode set to 100644
File size: 5.2 KB
RevLine 
[f5f7c24]1@using Microsoft.AspNetCore.Authentication.Cookies;
2@using Microsoft.AspNetCore.Authentication;
3@using Microsoft.AspNetCore.Http;
4@using System.Security.Claims
5@inject IHttpContextAccessor Accessor
6
7
8<!DOCTYPE html>
9<html lang="en">
10<head>
11 <meta charset="utf-8" />
12 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
13 <title>@ViewData["Title"] - ocrent</title>
14 <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
15 <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
16 <link rel="stylesheet" href="~/ocrent.styles.css" asp-append-version="true" />
17 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
18
19</head>
20<body>
21 @{
22 var userId = Context.Session.GetString("userId");
23 var username = Context.Session.GetString("firstname");
24 var email = Accessor.HttpContext.Session.GetString("email");
25 Claim? claim = null;
26 if(email!=null){
27 claim = Accessor.HttpContext.User.FindFirst(email);
28 }
29 //customClaim.Value
30
31 if(userId != null){
32
33 }
34 }
35 <header>
36 <nav class="navbar d-flex justify-content-between align-items-center navbar-expand-sm navbar-toggleable-sm">
37 <div class="container-fluid">
38 <a class="d-inline-block navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">
39 <img src="/img/ocrent_logo.png" style="max-height:60px;" alt="OCRent" />
40 </a>
41 <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
42 aria-expanded="false" aria-label="Toggle navigation">
43 <span class="navbar-toggler-icon"></span>
44 </button>
45 <div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
46 <ul class="navbar-nav flex-grow-1">
47 <li class="nav-item">
48 <a class="nav-link text-white" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
49 </li>
50 <li class="nav-item">
51 <a class="nav-link text-white" asp-area="" asp-controller="Search" asp-action="Index">Search</a>
52 </li>
53
54 @if(claim!=null){
55 if (claim.Value.Equals("BusinessUser") || claim.Value.Equals("Administrator")){
56 <li class="nav-item">
57 <a class="nav-link text-white" asp-area="" asp-controller="Company" asp-action="RegisterCompany">Register Company</a>
58 </li>
59 <li class="nav-item">
60 <a class="nav-link text-white" asp-area="" asp-controller="Company" asp-action="Index">My Companies</a>
61 </li>
62 }
63 if (claim.Value.Equals("Administrator")){
64 <li class="nav-item">
65 <a class="nav-link text-white" asp-area="" asp-controller="Administrator" asp-action="Companies">All Companies</a>
66 </li>
67 }
68 }
69
70
71 </ul>
72
73 @if(@userId != null){
74 <ul class="navbar-nav flex-grow-1 justify-content-end">
75 <li class="nav-item">
76 <a class="nav-link text-white">Hello @username!</a>
77 </li>
78 <li class="nav-item">
79 <a class="nav-link text-white" asp-area="" asp-controller="Identity" asp-action="Logout">Sign out</a>
80 </li>
81 </ul>
82 }else{
83 <ul class="navbar-nav flex-grow-1 justify-content-end">
84 <li class="nav-item">
85 <a class="nav-link text-white" asp-area="" asp-controller="Identity" asp-action="Register">Sign up</a>
86 </li>
87 <li class="nav-item">
88 <a class="nav-link text-white" asp-area="" asp-controller="Identity" asp-action="Login">Sign in</a>
89 </li>
90 </ul>
91 }
92
93 </div>
94 </div>
95 </nav>
96 </header>
97 <div class="container">
98 <main role="main" class="pb-3">
99 @RenderBody()
100 </main>
101 </div>
102
103
104 <script src="~/lib/jquery/dist/jquery.min.js"></script>
105 <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
106 <script src="~/js/site.js" asp-append-version="true"></script>
107 <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
108 @await RenderSectionAsync("Scripts", required: false)
109</body>
110</html>
Note: See TracBrowser for help on using the repository browser.