0
0

Add base carousel

This commit is contained in:
Sergey Chebotar 2023-02-06 21:32:40 +03:00
parent a2314e870e
commit b86579ea3f
5 changed files with 238 additions and 192 deletions

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using MyDarling.Models;
namespace MyDarling.Controllers
@ -10,9 +11,9 @@ namespace MyDarling.Controllers
{
this.context = context;
}
public async Task<IActionResult> Show(int id)
public IActionResult Show(int id)
{
return View(await context.UnderwearBundles.FindAsync(id));
return View(context.UnderwearBundles.Include(x => x.Figures).Where(x => x.Id == id).FirstOrDefault());
}
}
}

View File

@ -1,14 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<title>@Model?.Name</title>
</head>
<body>
<p>@Model?.Name</p>
<p>@Model?.Description</p>
</body>
</html>
@model MyDarling.Models.UnderwearBundle;
@{
Layout = "_Layout";
}
<nav class="navbar navbar-expand-lg navbar-dark fixed-top bg-black" id="mainNav">
<div class="container px-4 px-lg-5">
<a class="navbar-brand" href="/"><img height="40" src="/assets/img/logo.svg"></a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false"
aria-label="Toggle navigation">
Menu
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ms-auto">
<li class="nav-item"><a class="nav-link" href="/Home/Index#about">About</a></li>
<li class="nav-item"><a class="nav-link" href="/Home/Index#projects">Projects</a></li>
<li class="nav-item"><a class="nav-link" href="/Home/Index#signup">Contact</a></li>
</ul>
</div>
</div>
</nav>
<section class="projects-section bg-light">
<div class="container px-3 px-lg-4 mt-4">
<div class="row gx-4 gx-lg-5 justify-content-center ">
<div class="col-md">
<div id="carouselIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselIndicators" data-slide-to="0" class="active"></li>
@for (int i = 1; i < @Model?.Figures.Count(); i++)
{
<li data-target="#carouselIndicators" data-slide-to="@i"></li>
}
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="@Model?.Figures[0].FilePath" alt="...">
</div>
@for (int i = 1; i < @Model?.Figures.Count(); i++)
{
<div class="carousel-item">
<img class="d-block w-100" src="@Model?.Figures[i].FilePath" alt="...">
</div>
}
</div>
<a class="carousel-control-prev" href="#carouselIndicators" role="button" data-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="#carouselIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<div class="col-md">
<h1 class="mb-4">@Model?.Name</h1>
<p class="projects-section">@Model?.Description</p>
</div>
</div>
</div>
</section>

View File

@ -1,24 +1,10 @@
@model IQueryable<MyDarling.Models.UnderwearBundle>;
<!DOCTYPE html>
<html lang="ru-RU">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="Сайт-шоурум производителя нижнего белья ручной работы My Darling Underwear" />
<meta name="author" content="Екатерина Мануйлова" />
<title>My Darling Underwear</title>
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<script src="https://use.fontawesome.com/releases/v6.1.0/js/all.js" crossorigin="anonymous"></script>
<link href="/css/styles.css" rel="stylesheet" />
</head>
<body id="page-top">
<!-- Navigation-->
<nav class="navbar navbar-expand-lg navbar-dark fixed-top" id="mainNav">
@{
Layout = "_Layout";
}
<nav class="navbar navbar-expand-lg navbar-dark fixed-top" id="mainNav">
<div class="container px-4 px-lg-5">
<a class="navbar-brand" href="#page-top"><img height="40" src="assets/img/logo.svg"></a>
<a class="navbar-brand" href="#page-top"><img height="40" src="/assets/img/logo.svg"></a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false"
aria-label="Toggle navigation">
@ -33,21 +19,21 @@
</ul>
</div>
</div>
</nav>
<!-- Masthead-->
<header class="masthead">
</nav>
<!-- Masthead-->
<section class="masthead">
<div class="container px-4 px-lg-5 d-flex h-100 align-items-center justify-content-center">
<div class="d-flex justify-content-center">
<div class="text-center">
<img class="mx-auto my-0" height="140" src="assets/img/logo.svg"/>
<h2 class="text-white-50 mx-auto mt-4 mb-5">Нижнее бельё ручной работы по индивидуальным меркам</h2>
<h2 class="text-white-50 mx-auto mt-2 mb-5">>Нижнее бельё ручной работы по индивидуальным меркам</h2>
<a class="btn btn-primary" href="#about">Узнать больше</a>
</div>
</div>
</div>
</header>
<!-- About-->
<section class="about-section text-center" id="about">
</section>
<!-- About-->
<section class="about-section text-center" id="about">
<div class="container px-4 px-lg-5">
<div class="row gx-4 gx-lg-5 justify-content-center">
<div class="col-lg-8">
@ -62,16 +48,17 @@
</div>
<img class="img-fluid" src="assets/img/ipad.png" alt="..." />
</div>
</section>
<!-- Projects-->
<section class="projects-section bg-light" id="projects">
</section>
<!-- Projects-->
<section class="projects-section bg-light" id="projects">
<div class="container px-3 px-lg-4 mt-4">
<div class="row gx-4 gx-lg-5 row-cols-2 row-cols-md-3 row-cols-xl-4 justify-content-center">
@foreach (var bundle in @Model)
{
<div class="col mb-5">
<div class="card h-100">
<a href="/bundle/show/@bundle.Id"><img class="card-img-top" src="@bundle.Figures.FirstOrDefault()?.FilePath" alt="..." /></a>
<a href="/bundle/show/@bundle.Id"><img class="card-img-top"
src="@bundle.Figures.FirstOrDefault()?.FilePath" alt="..." /></a>
<div class="card-body p-4">
<div class="text-center">
<h5 class="fw-bolder">@bundle.Name</h5>
@ -83,9 +70,9 @@
}
</div>
</div>
</section>
<!-- Signup-->
<section class="signup-section" id="signup">
</section>
<!-- Signup-->
<section class="signup-section" id="signup">
<div class="container px-4 px-lg-5">
<div class="row gx-4 gx-lg-5">
<div class="col-md-10 col-lg-8 mx-auto text-center">
@ -135,9 +122,9 @@
</div>
</div>
</div>
</section>
<!-- Contact-->
<section class="contact-section bg-black">
</section>
<!-- Contact-->
<section class="contact-section bg-black">
<div class="container px-4 px-lg-5">
<div class="row gx-4 gx-lg-5">
<div class="col-md-4 mb-3 mb-md-0">
@ -177,15 +164,4 @@
<a class="mx-2" href="#!"><i class="fab fa-github"></i></a>
</div>
</div>
</section>
<!-- Footer-->
<footer class="footer bg-black small text-center text-white-50">
<div class="container px-4 px-lg-5">&copy; My Darling Underwear 2023</div>
</footer>
<!-- Bootstrap core JS-->
<script src="/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="/js/scripts.js"></script>
</body>
</html>
</section>

View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="ru-RU">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Grayscale - Start Bootstrap Theme</title>
<link rel="icon" type="image/x-icon" href="/assets/favicon.ico" />
<script src="https://use.fontawesome.com/releases/v6.1.0/js/all.js" crossorigin="anonymous"></script>
<link href="/css/styles.css" rel="stylesheet" />
</head>
<body id="page-top">
@RenderBody()
<footer class="footer bg-black small text-center text-white-50">
<div class="container px-4 px-lg-5">&copy; My Darling underwear 2023</div>
</footer>
<script src="/js/scripts.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.7/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js"></script>
</body>
</html>

View File

@ -1,10 +1,5 @@
{
"version": "1.0",
"defaultProvider": "cdnjs",
"libraries": [
{
"library": "bootstrap@5.2.3",
"destination": "wwwroot/lib/bootstrap"
}
]
"libraries": []
}