Migration added
This commit is contained in:
parent
eac2a698bd
commit
86d6e8c49d
28 changed files with 1290 additions and 7 deletions
26
Data/SurveyContext.cs
Normal file
26
Data/SurveyContext.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Data
|
||||
{
|
||||
public class SurveyContext:DbContext
|
||||
{
|
||||
public SurveyContext(DbContextOptions<SurveyContext> option):base(option)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DbSet<Page> Pages { get; set; }
|
||||
public DbSet<Banner> Banners { get; set; }
|
||||
|
||||
public DbSet<Address> Addresss { get; set; }
|
||||
public DbSet<Footer> Footers { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
38
Model/Address.cs
Normal file
38
Model/Address.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Model
|
||||
{
|
||||
public class Address
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string? Street { get; set; }
|
||||
|
||||
[Required]
|
||||
public string? City { get; set; }
|
||||
|
||||
public string? State { get; set; }
|
||||
[Required]
|
||||
public string? PostalCode { get; set; }
|
||||
[Required]
|
||||
public string? Country { get; set; }
|
||||
|
||||
public string? CVR { get; set; }
|
||||
|
||||
[Required]
|
||||
public string? Email { get; set; }
|
||||
[Required]
|
||||
public string? Mobile { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
28
Model/Banner.cs
Normal file
28
Model/Banner.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Model
|
||||
{
|
||||
public class Banner
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string? Title { get; set; }
|
||||
[Required]
|
||||
public string? Description { get; set; }
|
||||
[Required]
|
||||
public string? Content { get; set; }
|
||||
[Required]
|
||||
public string? LinkUrl { get; set; }
|
||||
[Required]
|
||||
public string? ImageUrl { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
33
Model/Footer.cs
Normal file
33
Model/Footer.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Model
|
||||
{
|
||||
public class Footer
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string? Title { get; set; }
|
||||
[Required]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[Required]
|
||||
public string? Owner { get; set; }
|
||||
|
||||
[Required]
|
||||
public string? Content { get; set; }
|
||||
|
||||
[Required]
|
||||
public string? CreatedBy { get; set; }
|
||||
[Required]
|
||||
public string? UpdatedBy { get; set;}
|
||||
|
||||
public DateTime LastUpdated { get; set; }
|
||||
[Required]
|
||||
public string? ImageUlr { get; set; }
|
||||
|
||||
[Required]
|
||||
public string? Sitecopyright { get; set;}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
26
Model/Page.cs
Normal file
26
Model/Page.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Model
|
||||
{
|
||||
public class Page
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string? Title { get; set; }
|
||||
public string? Slug { get; set; }
|
||||
[Required]
|
||||
public string? Content { get; set; }
|
||||
|
||||
|
||||
public int BannerId { get; set; }
|
||||
|
||||
[ForeignKey("BannerId")]
|
||||
public Banner? banner { get; set; }
|
||||
}
|
||||
}
|
||||
9
Repository/Repository.csproj
Normal file
9
Repository/Repository.csproj
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
55
Services/Implemnetation/BannerRepository.cs
Normal file
55
Services/Implemnetation/BannerRepository.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
using Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Model;
|
||||
using Services.Interaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Services.Implemnetation
|
||||
{
|
||||
public class BannerRepository : IBannerRepository
|
||||
{
|
||||
private readonly SurveyContext _context;
|
||||
|
||||
public BannerRepository(SurveyContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task Add(Banner banner)
|
||||
{
|
||||
await _context.Banners.AddAsync(banner);
|
||||
}
|
||||
|
||||
public async Task commitAsync()
|
||||
{
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
var banner = GetBannerById(id);
|
||||
|
||||
_context.Banners.Remove(banner);
|
||||
|
||||
}
|
||||
|
||||
public Banner GetBannerById(int id)
|
||||
{
|
||||
return _context.Banners.AsNoTracking().Where(x => x.Id == id).FirstOrDefault();
|
||||
}
|
||||
|
||||
public async Task<List<Banner>> GetBanners()
|
||||
{
|
||||
return await _context.Banners.AsNoTracking().ToListAsync();
|
||||
}
|
||||
|
||||
public void Update(Banner banner)
|
||||
{
|
||||
_context.Banners.Update(banner);
|
||||
}
|
||||
}
|
||||
}
|
||||
68
Services/Implemnetation/PageRepository.cs
Normal file
68
Services/Implemnetation/PageRepository.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Model;
|
||||
using Services.Interaces;
|
||||
|
||||
namespace Services.Implemnetation
|
||||
{
|
||||
public class PageRepository : IPageRepository
|
||||
{
|
||||
private readonly SurveyContext _context;
|
||||
|
||||
public PageRepository(SurveyContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
public void Add(Page page)
|
||||
{
|
||||
_context.Pages.Add(page);
|
||||
}
|
||||
|
||||
public async Task commitAsync()
|
||||
{
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
var page = GetPageById(id);
|
||||
|
||||
_context.Pages.Remove(page);
|
||||
}
|
||||
|
||||
public Page GetPageById(int id)
|
||||
{
|
||||
return _context.Pages.AsNoTracking().Where(x => x.Id == id).FirstOrDefault();
|
||||
}
|
||||
|
||||
public async Task<List<Page>> GetPages()
|
||||
{
|
||||
return await _context.Pages.ToListAsync();
|
||||
}
|
||||
|
||||
public Page GetPageSlug(string slug)
|
||||
{
|
||||
return _context.Pages.Where(x => x.Slug == slug).AsNoTracking().FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<Page> GetPageWithBanner()
|
||||
{
|
||||
return _context.Pages.Include(x => x.banner).AsNoTracking().ToList();
|
||||
}
|
||||
|
||||
public bool SlugExists(string slug, int? pageIdExclude = null)
|
||||
{
|
||||
if (pageIdExclude != null)
|
||||
{
|
||||
return _context.Pages.Where(x => x.Id != pageIdExclude).Any(x => x.Slug == slug);
|
||||
}
|
||||
|
||||
return _context.Pages.Any(x => x.Slug == slug);
|
||||
}
|
||||
|
||||
public void Update(Page page)
|
||||
{
|
||||
_context.Pages.Update(page);
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Services/Interaces/IBannerRepository.cs
Normal file
24
Services/Interaces/IBannerRepository.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Services.Interaces
|
||||
{
|
||||
public interface IBannerRepository
|
||||
{
|
||||
Task<List<Banner>> GetBanners();
|
||||
|
||||
Banner GetBannerById(int id);
|
||||
|
||||
Task Add(Banner banner);
|
||||
|
||||
void Delete(int id);
|
||||
|
||||
void Update(Banner banner);
|
||||
|
||||
Task commitAsync();
|
||||
}
|
||||
}
|
||||
35
Services/Interaces/IPageRepository.cs
Normal file
35
Services/Interaces/IPageRepository.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Services.Interaces
|
||||
{
|
||||
public interface IPageRepository
|
||||
{
|
||||
Task<List<Page>> GetPages();
|
||||
|
||||
Page GetPageById(int id);
|
||||
|
||||
void Add(Page page);
|
||||
|
||||
void Delete(int id);
|
||||
|
||||
void Update(Page page);
|
||||
|
||||
List<Page> GetPageWithBanner();
|
||||
|
||||
Page GetPageSlug(string slug);
|
||||
|
||||
bool SlugExists(string slug,int? pageIdExclude=null);
|
||||
|
||||
|
||||
|
||||
Task commitAsync();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
141
Services/SlugServices/SlugHelper.cs
Normal file
141
Services/SlugServices/SlugHelper.cs
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Services.SlugServices
|
||||
{
|
||||
public static class SlugService
|
||||
{
|
||||
public static string Create(bool toLower, params string[] values)
|
||||
{
|
||||
return Create(toLower, string.Join("-", values));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a slug.
|
||||
/// References:
|
||||
/// http://www.unicode.org/reports/tr15/tr15-34.html
|
||||
/// https://meta.stackexchange.com/questions/7435/non-us-ascii-characters-dropped-from-full-profile-url/7696#7696
|
||||
/// http://stackoverflow.com/questions/25259/how-do-you-include-a-webpage-title-as-part-of-a-webpage-url/25486#25486
|
||||
/// http://stackoverflow.com/questions/3769457/how-can-i-remove-accents-on-a-string
|
||||
/// </summary>
|
||||
/// <param name="toLower"></param>
|
||||
/// <param name="normalised"></param>
|
||||
/// <returns></returns>
|
||||
public static string Create(bool toLower, string value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
string normalised = value.Normalize(NormalizationForm.FormKD);
|
||||
|
||||
const int maxlen = 300;
|
||||
int len = normalised.Length;
|
||||
bool prevDash = false;
|
||||
StringBuilder sb = new StringBuilder(len);
|
||||
char c;
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
c = normalised[i];
|
||||
if (c >= 'a' && c <= 'z' || c >= '0' && c <= '9')
|
||||
{
|
||||
if (prevDash)
|
||||
{
|
||||
sb.Append('-');
|
||||
prevDash = false;
|
||||
}
|
||||
sb.Append(c);
|
||||
}
|
||||
else if (c >= 'A' && c <= 'Z')
|
||||
{
|
||||
if (prevDash)
|
||||
{
|
||||
sb.Append('-');
|
||||
prevDash = false;
|
||||
}
|
||||
// Tricky way to convert to lowercase
|
||||
if (toLower)
|
||||
{
|
||||
sb.Append((char)(c | 32));
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(c);
|
||||
}
|
||||
}
|
||||
else if (c == ' ' || c == ',' || c == '.' || c == '/' || c == '\\' || c == '-' || c == '_' || c == '=')
|
||||
{
|
||||
if (!prevDash && sb.Length > 0)
|
||||
{
|
||||
prevDash = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string swap = ConvertEdgeCases(c, toLower);
|
||||
|
||||
if (swap != null)
|
||||
{
|
||||
if (prevDash)
|
||||
{
|
||||
sb.Append('-');
|
||||
prevDash = false;
|
||||
}
|
||||
sb.Append(swap);
|
||||
}
|
||||
}
|
||||
|
||||
if (sb.Length == maxlen)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static string ConvertEdgeCases(char c, bool toLower)
|
||||
{
|
||||
string swap = null;
|
||||
switch (c)
|
||||
{
|
||||
case 'ı':
|
||||
swap = "i";
|
||||
break;
|
||||
|
||||
case 'ł':
|
||||
swap = "l";
|
||||
break;
|
||||
|
||||
case 'Ł':
|
||||
swap = toLower ? "l" : "L";
|
||||
break;
|
||||
|
||||
case 'đ':
|
||||
swap = "d";
|
||||
break;
|
||||
|
||||
case 'ß':
|
||||
swap = "ss";
|
||||
break;
|
||||
|
||||
case 'ø':
|
||||
swap = "o";
|
||||
break;
|
||||
|
||||
case 'Þ':
|
||||
swap = "th";
|
||||
break;
|
||||
|
||||
case '#':
|
||||
swap = "sharp";
|
||||
break;
|
||||
}
|
||||
return swap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,11 +5,11 @@ VisualStudioVersion = 17.8.34601.278
|
|||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Web", "Web\Web.csproj", "{0A90A5D7-CBD6-4956-B8EC-4E368736113F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "Model\Model.csproj", "{6EE5F607-221D-4DFF-B027-06D190BCD536}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "Model\Model.csproj", "{6EE5F607-221D-4DFF-B027-06D190BCD536}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Data\Data.csproj", "{D03B56FD-361D-49C5-B0D3-B48DDE90A217}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Data", "Data\Data.csproj", "{D03B56FD-361D-49C5-B0D3-B48DDE90A217}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Services", "Services\Services.csproj", "{61EE2AF3-6434-4DE4-BD66-222DC6E9AC4B}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Services", "Services\Services.csproj", "{61EE2AF3-6434-4DE4-BD66-222DC6E9AC4B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
|
|||
21
Web/Areas/Admin/Controllers/BannerController.cs
Normal file
21
Web/Areas/Admin/Controllers/BannerController.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Services.Interaces;
|
||||
|
||||
namespace Web.Areas.Admin.Controllers
|
||||
{
|
||||
public class BannerController : Controller
|
||||
{
|
||||
private readonly IBannerRepository _banner;
|
||||
|
||||
public BannerController(IBannerRepository banner)
|
||||
{
|
||||
_banner = banner;
|
||||
}
|
||||
public IActionResult Index()
|
||||
{
|
||||
|
||||
var baner = _banner.GetBanners();
|
||||
return View(baner);
|
||||
}
|
||||
}
|
||||
}
|
||||
65
Web/Areas/Admin/Views/Banner/Index.cshtml
Normal file
65
Web/Areas/Admin/Views/Banner/Index.cshtml
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
@model IEnumerable<Model.Banner>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Index";
|
||||
}
|
||||
|
||||
<h1>Index</h1>
|
||||
|
||||
<p>
|
||||
<a asp-action="Create">Create New</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Id)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Title)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Description)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Content)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LinkUrl)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.ImageUrl)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Title)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Description)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Content)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LinkUrl)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ImageUrl)
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
|
||||
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
25
Web/Areas/Admin/Views/Shared/Error.cshtml
Normal file
25
Web/Areas/Admin/Views/Shared/Error.cshtml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
49
Web/Areas/Admin/Views/Shared/_Layout.cshtml
Normal file
49
Web/Areas/Admin/Views/Shared/_Layout.cshtml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - Web</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/Web.styles.css" asp-append-version="true" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Web</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2024 - Web - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
48
Web/Areas/Admin/Views/Shared/_Layout.cshtml.css
Normal file
48
Web/Areas/Admin/Views/Shared/_Layout.cshtml.css
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
for details on configuring this project to bundle and minify static web assets. */
|
||||
|
||||
a.navbar-brand {
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0077cc;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
button.accept-policy {
|
||||
font-size: 1rem;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
line-height: 60px;
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
3
Web/Areas/Admin/Views/_ViewImports.cshtml
Normal file
3
Web/Areas/Admin/Views/_ViewImports.cshtml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
@using Web
|
||||
@using Web.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
3
Web/Areas/Admin/Views/_ViewStart.cshtml
Normal file
3
Web/Areas/Admin/Views/_ViewStart.cshtml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
27
Web/Extesions/ServicesExtesions.cs
Normal file
27
Web/Extesions/ServicesExtesions.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Services.Implemnetation;
|
||||
using Services.Interaces;
|
||||
|
||||
namespace Web.Extesions
|
||||
{
|
||||
public static class ServicesExtesions
|
||||
{
|
||||
public static void ConfigureSQLConnection(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddDbContext<SurveyContext>(option =>
|
||||
{
|
||||
option.UseSqlServer(configuration.GetConnectionString("SurveyVista"), cfg => cfg.MigrationsAssembly("Web"));
|
||||
});
|
||||
}
|
||||
|
||||
public static void ConfigurePageServices(this IServiceCollection services)
|
||||
{
|
||||
services.AddScoped<IPageRepository,PageRepository>();
|
||||
}
|
||||
public static void ConfigureBannerServices(this IServiceCollection services)
|
||||
{
|
||||
services.AddScoped<IBannerRepository, BannerRepository>();
|
||||
}
|
||||
}
|
||||
}
|
||||
194
Web/Migrations/20240220174310_initial.Designer.cs
generated
Normal file
194
Web/Migrations/20240220174310_initial.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Web.Migrations
|
||||
{
|
||||
[DbContext(typeof(SurveyContext))]
|
||||
[Migration("20240220174310_initial")]
|
||||
partial class initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Model.Address", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CVR")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("City")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Country")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Mobile")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PostalCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Street")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Addresss");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Banner", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ImageUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LinkUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Banners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Footer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ImageUlr")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("LastUpdated")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Sitecopyright")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UpdatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Footers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Page", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BannerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BannerId");
|
||||
|
||||
b.ToTable("Pages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Page", b =>
|
||||
{
|
||||
b.HasOne("Model.Banner", "banner")
|
||||
.WithMany()
|
||||
.HasForeignKey("BannerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("banner");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
116
Web/Migrations/20240220174310_initial.cs
Normal file
116
Web/Migrations/20240220174310_initial.cs
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Web.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Addresss",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Street = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
City = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
State = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
PostalCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Country = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CVR = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Mobile = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Addresss", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Banners",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
LinkUrl = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Banners", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Footers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Owner = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
LastUpdated = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ImageUlr = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Sitecopyright = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Footers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Pages",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Slug = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
BannerId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Pages", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Pages_Banners_BannerId",
|
||||
column: x => x.BannerId,
|
||||
principalTable: "Banners",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Pages_BannerId",
|
||||
table: "Pages",
|
||||
column: "BannerId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Addresss");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Footers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Pages");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Banners");
|
||||
}
|
||||
}
|
||||
}
|
||||
191
Web/Migrations/SurveyContextModelSnapshot.cs
Normal file
191
Web/Migrations/SurveyContextModelSnapshot.cs
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Web.Migrations
|
||||
{
|
||||
[DbContext(typeof(SurveyContext))]
|
||||
partial class SurveyContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Model.Address", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("CVR")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("City")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Country")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Mobile")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PostalCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Street")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Addresss");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Banner", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ImageUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LinkUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Banners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Footer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ImageUlr")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("LastUpdated")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Sitecopyright")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UpdatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Footers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Page", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BannerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BannerId");
|
||||
|
||||
b.ToTable("Pages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Model.Page", b =>
|
||||
{
|
||||
b.HasOne("Model.Banner", "banner")
|
||||
.WithMany()
|
||||
.HasForeignKey("BannerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("banner");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,17 @@
|
|||
using Services.Implemnetation;
|
||||
using Services.Interaces;
|
||||
using Web.Extesions;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
builder.Services.ConfigureSQLConnection(builder.Configuration);
|
||||
|
||||
builder.Services.AddScoped<IPageRepository,PageRepository>();
|
||||
builder.Services.AddScoped<IBannerRepository,BannerRepository>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
|
@ -20,6 +29,10 @@ app.UseRouting();
|
|||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "SurveyVista",
|
||||
pattern:"Admin/{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,41 @@
|
|||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
<div id="carouselExampleIndicators" class="carousel slide" data-bs-ride="carousel">
|
||||
<ol class="carousel-indicators">
|
||||
<li data-bs-target="#carouselExampleIndicators" data-bs-slide-to="0" class="active"></li>
|
||||
<li data-bs-target="#carouselExampleIndicators" data-bs-slide-to="1"></li>
|
||||
<li data-bs-target="#carouselExampleIndicators" data-bs-slide-to="2"></li>
|
||||
</ol>
|
||||
<div class="carousel-inner">
|
||||
<div class="carousel-item active">
|
||||
<img src="https://mdbootstrap.com/img/Photos/Slides/img%20(45).jpg"
|
||||
class="d-block w-100"
|
||||
alt="first slide" />
|
||||
</div>
|
||||
<div class="carousel-item">
|
||||
<img src="https://mdbootstrap.com/img/Photos/Slides/img%20(46).jpg"
|
||||
class="d-block w-100"
|
||||
alt="second slide" />
|
||||
</div>
|
||||
<div class="carousel-item">
|
||||
<img src="https://mdbootstrap.com/img/Photos/Slides/img%20(47).jpg"
|
||||
class="d-block w-100"
|
||||
alt="third slide" />
|
||||
</div>
|
||||
</div>
|
||||
<a class="carousel-control-prev"
|
||||
href="#carouselExampleIndicators"
|
||||
role="button"
|
||||
data-bs-slide="prev">
|
||||
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a class="carousel-control-next"
|
||||
href="#carouselExampleIndicators"
|
||||
role="button"
|
||||
data-bs-slide="next">
|
||||
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -7,10 +7,12 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
@ -19,4 +21,8 @@
|
|||
<ProjectReference Include="..\Services\Services.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -5,5 +5,8 @@
|
|||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"SurveyVista": "data source=SEO-PC; initial catalog=SurveyVista; integrated security=true; TrustServerCertificate=true;"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue