From 4aac347867917948cad1ccdea651a9b3702f90a3 Mon Sep 17 00:00:00 2001 From: Serghei Cebotari Date: Mon, 29 Jan 2024 14:34:51 +0300 Subject: [PATCH] Add yandex feed --- Pages/Feed.xml.cshtml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Pages/Feed.xml.cshtml diff --git a/Pages/Feed.xml.cshtml b/Pages/Feed.xml.cshtml new file mode 100644 index 0000000..c17981f --- /dev/null +++ b/Pages/Feed.xml.cshtml @@ -0,0 +1,42 @@ +@page "/feed.yml" +@using Microsoft.AspNetCore.Http +@using Microsoft.EntityFrameworkCore +@inject MyDarling.Models.DataContext context +@{ + var p = + new { Url = "https://mydarlingunderwear.ru/", LastUpdated = DateTime.Today }; + Response.ContentType = "text/xml"; + var products = context.Products + .Include(b => b.Figures) + .Where(b => b.Price != 0 && b.Figures.Count > 0); + await Response.WriteAsync(""); + var updateDate = p.LastUpdated.ToString("yyyy-MM-dd"); +} + + + + My Darling Underwear + Екатерина Мануйлова + @p.Url + + + + + Нижнее бельё + + + @foreach (var product in products) + { + var figureUrl = $"{@p.Url}Content/{@product.Id}/{@product.Figures[0].Id}.jpg"; + + @p.Url#@product.Id-1 + @product.Price + RUR + 1 + @product.Name + @figureUrl + + } + + + \ No newline at end of file