From 81c1fc0c14253457c3c4fc24735e787ace1db70b Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Tue, 30 May 2023 07:18:47 +0300 Subject: Add index razor page --- Controllers/HomeController.cs | 19 ---------------- Pages/Index.cshtml | 13 +++++++++++ Pages/Shared/_About.cshtml | 20 +++++++++++++++++ Pages/Shared/_Layout.cshtml | 50 +++++++++++++++++++++++++++++++++++++++++ Pages/Shared/_Masthead.cshtml | 11 +++++++++ Pages/Shared/_Navigation.cshtml | 18 +++++++++++++++ Pages/Shared/_Projects.cshtml | 39 ++++++++++++++++++++++++++++++++ Pages/Shared/_SignUp.cshtml | 17 ++++++++++++++ Program.cs | 2 ++ Views/Home/Index.cshtml | 11 --------- Views/Home/_About.cshtml | 20 ----------------- Views/Home/_Masthead.cshtml | 11 --------- Views/Home/_Projects.cshtml | 31 ------------------------- Views/Home/_SignUp.cshtml | 17 -------------- Views/Shared/_Layout.cshtml | 50 ----------------------------------------- Views/Shared/_Navigation.cshtml | 18 --------------- 16 files changed, 170 insertions(+), 177 deletions(-) delete mode 100644 Controllers/HomeController.cs create mode 100644 Pages/Index.cshtml create mode 100644 Pages/Shared/_About.cshtml create mode 100644 Pages/Shared/_Layout.cshtml create mode 100644 Pages/Shared/_Masthead.cshtml create mode 100644 Pages/Shared/_Navigation.cshtml create mode 100644 Pages/Shared/_Projects.cshtml create mode 100644 Pages/Shared/_SignUp.cshtml delete mode 100644 Views/Home/Index.cshtml delete mode 100644 Views/Home/_About.cshtml delete mode 100644 Views/Home/_Masthead.cshtml delete mode 100644 Views/Home/_Projects.cshtml delete mode 100644 Views/Home/_SignUp.cshtml delete mode 100644 Views/Shared/_Layout.cshtml delete mode 100644 Views/Shared/_Navigation.cshtml diff --git a/Controllers/HomeController.cs b/Controllers/HomeController.cs deleted file mode 100644 index 028322c..0000000 --- a/Controllers/HomeController.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using MyDarling.Models; - -namespace MyDarling.Controllers -{ - public class HomeController : Controller - { - private DataContext context; - public HomeController(DataContext context) - { - this.context = context; - } - public IActionResult Index() - { - return View(context.UnderwearBundles.Include(b => b.Figures)); - } - } -} \ No newline at end of file diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml new file mode 100644 index 0000000..a3ec3a5 --- /dev/null +++ b/Pages/Index.cshtml @@ -0,0 +1,13 @@ +@page +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@using MyDarling.Models; +@inject DataContext context; +@{ + Layout="_Layout"; +} + + + + + + \ No newline at end of file diff --git a/Pages/Shared/_About.cshtml b/Pages/Shared/_About.cshtml new file mode 100644 index 0000000..e7bffcb --- /dev/null +++ b/Pages/Shared/_About.cshtml @@ -0,0 +1,20 @@ +
+
+
+
+
Шьем с 2017 года.
+

За 6 лет сшили более трех тысяч изделий и осчастливили более тысячи заказчиц. Станьте следующей обладательницей идеального нижнего белья.

+
Что вы получаете, заказывая нижнее белье у нас?
+
    +
  • Ручная работа. Высокое качество.
  • +
  • Составьте свой комплект лифа, трусиков и аксессуаров из нашего каталога.
  • +
  • Сошьем комплект по вашим меркам. Идеальная посадка.
  • +
  • Сделаем трусики и пояса любого размера. Лифы от 70В/75А до 90В.
  • +
+
+
+ +
+
\ No newline at end of file diff --git a/Pages/Shared/_Layout.cshtml b/Pages/Shared/_Layout.cshtml new file mode 100644 index 0000000..9c56830 --- /dev/null +++ b/Pages/Shared/_Layout.cshtml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + My Darling Underwear - нижнее бельё ручной работы + + + + + + + + + + + + @RenderBody() +
+
My Darling Underwear © 2023
+
+ + + + + + \ No newline at end of file diff --git a/Pages/Shared/_Masthead.cshtml b/Pages/Shared/_Masthead.cshtml new file mode 100644 index 0000000..531a9a1 --- /dev/null +++ b/Pages/Shared/_Masthead.cshtml @@ -0,0 +1,11 @@ +
+
+
+
+ +

Нижнее бельё ручной работы по индивидуальным меркам

+ Узнать больше +
+
+
+
\ No newline at end of file diff --git a/Pages/Shared/_Navigation.cshtml b/Pages/Shared/_Navigation.cshtml new file mode 100644 index 0000000..7c29a6b --- /dev/null +++ b/Pages/Shared/_Navigation.cshtml @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/Pages/Shared/_Projects.cshtml b/Pages/Shared/_Projects.cshtml new file mode 100644 index 0000000..4b9a62e --- /dev/null +++ b/Pages/Shared/_Projects.cshtml @@ -0,0 +1,39 @@ +@using System.Globalization +@using Microsoft.EntityFrameworkCore +@using MyDarling.Models +@inject DataContext context + +@{ + var bundles = context.UnderwearBundles + .Include(b => b.Figures) + .Where(b => b.Price != 0 && b.Figures.Count > 0) + .OrderByDescending(b => b.Id); +} + +
+
+
+ @foreach (var bundle in bundles) + { +
+
+ @bundle.Name + @for (int i = 1; i < @bundle.Figures.Count(); i++) + { + + } +
+
+
@bundle.Name
+ @String.Format(new CultureInfo("ru-RU"), "{0:C0}", @bundle.Price) +
+
+
+
+ } +
+
+
\ No newline at end of file diff --git a/Pages/Shared/_SignUp.cshtml b/Pages/Shared/_SignUp.cshtml new file mode 100644 index 0000000..02584f6 --- /dev/null +++ b/Pages/Shared/_SignUp.cshtml @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/Program.cs b/Program.cs index cfc572a..361be3e 100644 --- a/Program.cs +++ b/Program.cs @@ -26,12 +26,14 @@ builder.Services.Configure( opts => }); builder.Services.AddControllersWithViews(); +builder.Services.AddRazorPages(); var app = builder.Build(); app.UseStaticFiles(); app.MapControllers(); app.MapDefaultControllerRoute(); +app.MapRazorPages(); app.UseAuthentication(); app.UseAuthorization(); diff --git a/Views/Home/Index.cshtml b/Views/Home/Index.cshtml deleted file mode 100644 index 54ff64d..0000000 --- a/Views/Home/Index.cshtml +++ /dev/null @@ -1,11 +0,0 @@ -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers - -@{ - Layout = "_Layout"; -} - - - - - - \ No newline at end of file diff --git a/Views/Home/_About.cshtml b/Views/Home/_About.cshtml deleted file mode 100644 index e7bffcb..0000000 --- a/Views/Home/_About.cshtml +++ /dev/null @@ -1,20 +0,0 @@ -
-
-
-
-
Шьем с 2017 года.
-

За 6 лет сшили более трех тысяч изделий и осчастливили более тысячи заказчиц. Станьте следующей обладательницей идеального нижнего белья.

-
Что вы получаете, заказывая нижнее белье у нас?
-
    -
  • Ручная работа. Высокое качество.
  • -
  • Составьте свой комплект лифа, трусиков и аксессуаров из нашего каталога.
  • -
  • Сошьем комплект по вашим меркам. Идеальная посадка.
  • -
  • Сделаем трусики и пояса любого размера. Лифы от 70В/75А до 90В.
  • -
-
-
- -
-
\ No newline at end of file diff --git a/Views/Home/_Masthead.cshtml b/Views/Home/_Masthead.cshtml deleted file mode 100644 index 531a9a1..0000000 --- a/Views/Home/_Masthead.cshtml +++ /dev/null @@ -1,11 +0,0 @@ -
-
-
-
- -

Нижнее бельё ручной работы по индивидуальным меркам

- Узнать больше -
-
-
-
\ No newline at end of file diff --git a/Views/Home/_Projects.cshtml b/Views/Home/_Projects.cshtml deleted file mode 100644 index 1eb67bc..0000000 --- a/Views/Home/_Projects.cshtml +++ /dev/null @@ -1,31 +0,0 @@ -@model IQueryable; -@using System.Globalization; - -
-
-
- @foreach (var bundle in @Model.Where(b => b.Price != 0 && b.Figures.Count > 0) - .OrderByDescending(b => b.Id)) - { -
-
- @bundle.Name - @for (int i = 1; i < @bundle.Figures.Count(); i++) - { - - } -
-
-
@bundle.Name
- @String.Format(new CultureInfo("ru-RU"), "{0:C0}", @bundle.Price) -
-
-
-
- } -
-
-
\ No newline at end of file diff --git a/Views/Home/_SignUp.cshtml b/Views/Home/_SignUp.cshtml deleted file mode 100644 index 02584f6..0000000 --- a/Views/Home/_SignUp.cshtml +++ /dev/null @@ -1,17 +0,0 @@ - \ No newline at end of file diff --git a/Views/Shared/_Layout.cshtml b/Views/Shared/_Layout.cshtml deleted file mode 100644 index 9c56830..0000000 --- a/Views/Shared/_Layout.cshtml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - My Darling Underwear - нижнее бельё ручной работы - - - - - - - - - - - - @RenderBody() -
-
My Darling Underwear © 2023
-
- - - - - - \ No newline at end of file diff --git a/Views/Shared/_Navigation.cshtml b/Views/Shared/_Navigation.cshtml deleted file mode 100644 index 7c29a6b..0000000 --- a/Views/Shared/_Navigation.cshtml +++ /dev/null @@ -1,18 +0,0 @@ - \ No newline at end of file -- cgit v1.2.3