Skip to content

Add Product Feed Generation Endpoint #1133 #1134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using SimplCommerce.Module.Catalog.Models;
using SimplCommerce.Module.Catalog.Services;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using SimplCommerce.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;

namespace SimplCommerce.Module.Catalog.Controllers
{
[Area("Catalog")]
public class FeedController : Controller
{
private readonly IRepository<Product> _productRepository;

public FeedController(IRepository<Product> productRepository)
{
_productRepository = productRepository;
}

public IActionResult Index()
{
var products = _productRepository.Query().Include(p => p.ThumbnailImage).ToList();
return View(products);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
@model List<SimplCommerce.Module.Catalog.Models.Product>
@using System.Text.RegularExpressions
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>All Products</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f5f5f5;
margin: 0;
padding: 0;
}
h1 {
text-align: center;
margin-top: 30px;
color: #333;
}

.product-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 20px;
padding: 40px 20px;
}

.product-card {
background-color: #fff;
border: 1px solid #e0e0e0;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
width: 250px;
text-align: center;
padding: 20px;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.product-card img {
width: 100%;
height: 180px;
object-fit: cover;
border-radius: 8px;
margin-bottom: 10px;
}

.product-card h3 {
font-size: 1.2rem;
margin-bottom: 10px;
color: #333;
}

.product-card p {
font-size: 0.9rem;
color: #555;
height: 50px;
overflow: hidden;
}

.product-card strong {
display: block;
margin-top: 10px;
color: #d32f2f;
font-size: 1rem;
}
</style>
</head>
<body>
<h1>All Products</h1>

<div class="product-container">
@foreach (var product in Model)
{
<div style="border: 1px solid #ddd; padding: 16px; margin-bottom: 12px;">
<img src="/user-content/@product.ThumbnailImage?.FileName" alt="@product.Name" style="max-width: 150px;" />

<h3>@product.Name</h3>
<p>@Html.Raw(Regex.Replace(product.Description, "<.*?>", string.Empty))</p>
<strong>Price: ₹@product.Price.ToString("F2")</strong>
</div>
}
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
Expand Down
1 change: 0 additions & 1 deletion src/SimplCommerce.WebHost/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@using System.Globalization

<!doctype html>
<html lang="@CultureInfo.CurrentUICulture.Name.ToLowerInvariant()">
<head>
Expand Down
5 changes: 5 additions & 0 deletions src/SimplCommerce.WebHost/Views/Shared/_LoginPartial.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
<button type="submit" class="btn btn-link">@Localizer["Log off"]</button>
</form>
</li>
<li class="nav-item">
<a class="nav-link" asp-area="Catalog" asp-controller="Feed" asp-action="Index">@Localizer["Feed"]</a>
</li>
}
else
{
<li class="nav-item"><a class="nav-link" asp-area="Core" asp-controller="Account" asp-action="Login">@Localizer["Log in"]</a></li>
<li class="nav-item"><a class="nav-link" asp-area="Core" asp-controller="Account" asp-action="Register">@Localizer["Register"]</a></li>
<li class="nav-item"><a class="nav-link" asp-area="Catalog" asp-controller="Feed" asp-action="Index">@Localizer["Feed"]</a>
</li>
}
4 changes: 2 additions & 2 deletions src/SimplCommerce.WebHost/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=SimplCommerce;Trusted_Connection=True;TrustServerCertificate=true;MultipleActiveResultSets=true"
},
"DefaultConnection": "Server=.;Database=SimplCommerce;Trusted_Connection=True;TrustServerCertificate=true;MultipleActiveResultSets=true"
},
"Authentication" : {
"Facebook" : {
"AppId" : "1716532045292977",
Expand Down
32 changes: 32 additions & 0 deletions src/SimplCommerce.WebHost/tempkey.jwk
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"AdditionalData": {},
"Alg": "RS256",
"Crv": null,
"D": "RLRLUJre8czi5fIc8noc_KCxdHIJDn5Y21E4VZACAYUaLVoYMkYDqNOHABxgaPAWUx4tUEc6jay5s92ModhnMNDmxd1aYt_4rEMWAoeQpLuzIXaKziqDm5YnQuBwj7MLkGfCfbv_sVtTo9QRss-KxGiNwp7bp3GC7kkC2iz_F8xYj6NUR_WtrKCvqwX5R3D7sKneZ47zfFG1nHhnqg2wv3skCIuC4_67yv32U9OtCWtdgeQNci3BoF6lZtz_fYXjKaXp3A1LWAuvCqQa4pArhk0a1LccrCcQtbW-JBuAk1j3bpQzdcH0H1FL0Bl-vbja6quW9cr9WaIzI-czUup_rQ",
"DP": "RaIWsXvyDqNyKrRttG9xODemYNFjr2HobOVQjkouecVI0vZDFGYtjam3kuVgdYGaTQPaJlfZyVYJVAUcXoL7kJYs-kNOkhou53iBzX4_kXNq37-asdteAb72ojNMK9XSar3qP0BMcnzQoSCouAlh_JLR-7x3uOzx_VD3l8XFTms",
"DQ": "TM1RZcRqUvcO88GyG37IjLFufKTVtKhNDsI8LiplJ0iA4bh9UBf4XZw1JSbXmHkM5mxx2kYhn62p2Laa4awsW_c0mN0MvoYCGIGRhUlOZr7en4iPm9B9q-ktXdJ69O9sDPhghOvLzAegW28I2HJItT6LkdpXrOG_nYtG2TsQs40",
"E": "AQAB",
"K": null,
"KeyId": "0AD55BF91BD1B5683FB6C6497CDAFCD8",
"Kid": "0AD55BF91BD1B5683FB6C6497CDAFCD8",
"Kty": "RSA",
"N": "z4tSgQvmnUqYgy4i9Vtud9YoiNOFJSapKQF4i7cqZEP20zLjS4izoPooL7Yvhan4OeuLQbJdudQ2_qhkJp8leq9py640p3IQl-7wwwBC-uUJFn-nso-ILzh5CFDAk67_Fb1FIUUU_AkS-eVfrDARaoilPJ-oGAnYd77IhNGI8qeYxPbaTTqLm3cGUdFhNxHeUdZirDHDCb8riW2swuEKrFVkfaMQTRh2RQeszRAK_3yZ-oW-rLRMSxsdZ4dPy_Ewa6TvgPeU-3wK9jpmYO2bNE_s8EkSLu8Vp1eY6xOB1hbuwJNLDtdRNcyPXu2HhBvlJH1cRLobDNGPKOtRu_EZ6Q",
"Oth": null,
"P": "2v2iEPXu6CyHjP-TN7may3gdStj6UlnyJxx08fFwlptiOAgI4K1ilRorUr-02nJRk-WaL-kBNMj16jyqms2laFrgZZ9H5RTPbzr4P5YFYIIS7sU_d9y3f1Fdr1BCnw_J9FVqQ6uspV30Wnrk0pW5x8VPjMzNnPgjA7Wdgrzgqgc",
"Q": "8p54INiWiXtMK71wFYgO8wS0IuNs7clhfzbAKMC893Tom0zQsll-TeU7a5PdJOdctteNxIW2R7WvLe8dP6L7yBIryD6oAzFkJ9QYd8eUM2X3vMNaG_zb_2S7jTB0lBso2W5o2raWZPsxOVKnqnNEbijtt6nWlAuBuy4U1fH04I8",
"QI": "ozeVgsQSv3ny7U9JmOLgQ5tPFLGqv4wv0lSyXGJuFftpzZEbGO1Y-JIVogB6WI-Ojff1YqqtxEdOHjfHNuZWLmV7z8gS1ByrUWLWDHfP1NaA50OvLJR-5wTXl6y9endMUxrDGr7QdZwyhscv_hfuu9JLkms377szloAbj-BmwEs",
"Use": null,
"X": null,
"X5t": null,
"X5tS256": null,
"X5u": null,
"Y": null,
"KeySize": 2048,
"HasPrivateKey": true,
"CryptoProviderFactory": {
"CryptoProviderCache": {},
"CustomCryptoProvider": null,
"CacheSignatureProviders": true,
"SignatureProviderObjectPoolCacheSize": 32
}
}