Add index razor page
This commit is contained in:
parent
55b30fc75a
commit
81c1fc0c14
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
@page
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
@using MyDarling.Models;
|
||||
@inject DataContext context;
|
||||
@{
|
||||
Layout="_Layout";
|
||||
}
|
@ -1,11 +1,19 @@
|
||||
@model IQueryable<MyDarling.Models.UnderwearBundle>;
|
||||
@using System.Globalization;
|
||||
@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);
|
||||
}
|
||||
|
||||
<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.Where(b => b.Price != 0 && b.Figures.Count > 0)
|
||||
.OrderByDescending(b => b.Id))
|
||||
@foreach (var bundle in bundles)
|
||||
{
|
||||
<div class="col mb-5">
|
||||
<div class="card h-100">
|
@ -26,12 +26,14 @@ builder.Services.Configure<IdentityOptions>( opts =>
|
||||
});
|
||||
|
||||
builder.Services.AddControllersWithViews();
|
||||
builder.Services.AddRazorPages();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
app.MapDefaultControllerRoute();
|
||||
app.MapRazorPages();
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
Loading…
Reference in New Issue
Block a user