(feat): mapping content collection
This commit is contained in:
parent
c91a4f4776
commit
c48f9ed980
21
webapi/Core/Abstractions/DomainObjects/AddressSectionBase.cs
Normal file
21
webapi/Core/Abstractions/DomainObjects/AddressSectionBase.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Core.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.Abstractions.DomainObjects {
|
||||
public abstract class AddressSectionBase<T> : PageSectionBase<T> {
|
||||
public FormItem FirstName { get; set; }
|
||||
public FormItem LastName { get; set; }
|
||||
|
||||
public FormItem Address { get; set; }
|
||||
public FormItem Address2 { get; set; }
|
||||
public FormItem Country { get; set; }
|
||||
public FormItem State { get; set; }
|
||||
|
||||
public FormItem City { get; set; }
|
||||
public FormItem Zip { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
using Core.Entities;
|
||||
using Core.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.Entities {
|
||||
namespace Core.DomainObjects {
|
||||
public class Address {
|
||||
public string Street { get; set; }
|
||||
public string City { get; set; }
|
||||
@ -1,14 +0,0 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
|
||||
namespace Core.DomainObjects {
|
||||
public class BlogItem : DomainObjectBase<BlogItem> {
|
||||
|
||||
public int? ReadTime { get; set; }
|
||||
|
||||
public int? Likes { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.Entities {
|
||||
namespace Core.DomainObjects {
|
||||
public class Contact {
|
||||
public string Value { get; set; }
|
||||
public bool IsConfirmed { get; set; }
|
||||
@ -3,8 +3,9 @@
|
||||
namespace Core.DomainObjects.Documents {
|
||||
public class BlogItem : PostItemBase<BlogItem> {
|
||||
|
||||
public int Likes { get; set; }
|
||||
public int ReadingTime { get; set; }
|
||||
public int? ReadTime { get; set; }
|
||||
|
||||
public int? Likes { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
|
||||
@ -5,6 +5,8 @@ namespace Core.DomainObjects.Documents {
|
||||
|
||||
public class Content : DomainObjectDocumentBase<Content> {
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
|
||||
public string SiteName { get; set; }
|
||||
public string SiteUrl { get; set; }
|
||||
|
||||
@ -23,9 +25,15 @@ namespace Core.DomainObjects.Documents {
|
||||
|
||||
public ShopCatalogPage ShopCatalog { get; set; }
|
||||
public ShopItemPage ShopItem { get; set; }
|
||||
public ShopCartPage ShopCart { get; set; }
|
||||
public ShopCheckoutPage ShopCheckout { get; set; }
|
||||
|
||||
|
||||
public BlogCatalogPage BlogCatalog { get; set; }
|
||||
public BlogItemPage Blogitem { get; set; }
|
||||
public BlogItemPage BlogItem { get; set; }
|
||||
|
||||
public SignInPage SignIn { get; set; }
|
||||
public SignUpPage SignUp { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
using Core.Abstractions;
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using Core.Entities;
|
||||
using Core.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@ -8,6 +8,8 @@ using System.Threading.Tasks;
|
||||
namespace Core.DomainObjects {
|
||||
public class FormItem : DomainObjectBase<FormItem> {
|
||||
public string? Title { get; set; }
|
||||
|
||||
public string? Optional { get; set; }
|
||||
public string? PlaceHolder { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
|
||||
@ -3,11 +3,11 @@
|
||||
namespace Core.DomainObjects {
|
||||
public class Header : DomainObjectBase<Header> {
|
||||
|
||||
public string Title { get; set; }
|
||||
public string? Title { get; set; }
|
||||
|
||||
public Dictionary<string, string> HeaderLink { get; set; }
|
||||
public Dictionary<string, string>? Meta { get; set; }
|
||||
|
||||
public Dictionary<string, string> Meta { get; set; }
|
||||
public Dictionary<string, string>? Link { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
|
||||
@ -8,17 +8,17 @@ using System.Threading.Tasks;
|
||||
namespace Core.DomainObjects {
|
||||
public class Localization : DomainObjectBase<Localization> {
|
||||
|
||||
public string TimeZone { get; set; }
|
||||
public string? TimeZone { get; set; }
|
||||
|
||||
public string Locale { get; set; }
|
||||
public string? Locale { get; set; }
|
||||
|
||||
public string DateFormat { get; set; }
|
||||
public string? DateFormat { get; set; }
|
||||
|
||||
public string TimeFormat { get; set; }
|
||||
public string? TimeFormat { get; set; }
|
||||
|
||||
public string Currency { get; set; }
|
||||
public string? Currency { get; set; }
|
||||
|
||||
public string CurrencySymobol { get; set; }
|
||||
public string? CurrencySymbol { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.PageSections {
|
||||
public class BillingAddressSection : AddressSectionBase<BillingAddressSection> {
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.PageSections {
|
||||
public class FeaturedBlogSection : PageSectionBase<FeaturedBlogSection> {
|
||||
public class FeaturedBlogsSection : PageSectionBase<FeaturedBlogsSection> {
|
||||
public string ReadTime { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
|
||||
20
webapi/Core/DomainObjects/PageSections/PaymentSection.cs
Normal file
20
webapi/Core/DomainObjects/PageSections/PaymentSection.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.PageSections {
|
||||
public class PaymentSection : PageSectionBase<PaymentSection> {
|
||||
|
||||
public FormItem NameOnCard { get; set; }
|
||||
public FormItem CardNumber { get; set; }
|
||||
|
||||
public FormItem Expiration { get; set; }
|
||||
public FormItem Cvv { get; set; }
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
25
webapi/Core/DomainObjects/PageSections/ProductsSection.cs
Normal file
25
webapi/Core/DomainObjects/PageSections/ProductsSection.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.PageSections {
|
||||
public class ProductsSection : PageSectionBase<ProductSection> {
|
||||
public string Product { get; set; }
|
||||
public string Price { get; set; }
|
||||
|
||||
public string Quantity { get; set; }
|
||||
|
||||
public string Subtotal { get; set; }
|
||||
|
||||
public Link ContinueShopping { get; set; }
|
||||
|
||||
public FormItem Submit { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.PageSections {
|
||||
public class RelatedProductsSection : PageSectionBase<RelatedProductsSection> {
|
||||
|
||||
public string AddToCart { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
17
webapi/Core/DomainObjects/PageSections/SettingsSection.cs
Normal file
17
webapi/Core/DomainObjects/PageSections/SettingsSection.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.PageSections {
|
||||
public class SettingsSection : PageSectionBase<SettingsSection> {
|
||||
|
||||
public string ShippingAddressSameAsBillingAddress { get; set; }
|
||||
public string SaveThisInformation { get; set; }
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.PageSections {
|
||||
public class ShippingAddressSection : AddressSectionBase<ShippingAddressSection> {
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
17
webapi/Core/DomainObjects/PageSections/ShopItemsSection.cs
Normal file
17
webapi/Core/DomainObjects/PageSections/ShopItemsSection.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.PageSections {
|
||||
public class ShopItemsSection : PageSectionBase<ShopItemsSection> {
|
||||
|
||||
public string AddToCart { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
21
webapi/Core/DomainObjects/PageSections/SummarySection.cs
Normal file
21
webapi/Core/DomainObjects/PageSections/SummarySection.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.PageSections {
|
||||
public class SummarySection : PageSectionBase<SummarySection> {
|
||||
|
||||
public string Total { get; set; }
|
||||
|
||||
public FormItem PromoCode { get; set; }
|
||||
|
||||
public FormItem Submit { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,8 +4,10 @@ using Core.DomainObjects.PageSections;
|
||||
namespace Core.DomainObjects.Pages {
|
||||
public class BlogCatalogPage : PageBase<BlogCatalogPage> {
|
||||
|
||||
public Header Header { get; set; }
|
||||
|
||||
public TitleSection TitleSection { get; set; }
|
||||
public FeaturedBlogSection FeaturedBlogSection { get; set; }
|
||||
public FeaturedBlogsSection FeaturedBlogSection { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
|
||||
@ -3,6 +3,8 @@ using Core.DomainObjects.PageSections;
|
||||
|
||||
namespace Core.DomainObjects.Pages {
|
||||
public class BlogItemPage : PageBase<BlogItemPage> {
|
||||
|
||||
public Header Header { get; set; }
|
||||
public BlogTitleSection TitleSection { get; set; }
|
||||
public CommentsSection CommentsSection { get; set; }
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ using Core.DomainObjects.PageSections;
|
||||
namespace Core.DomainObjects.Pages {
|
||||
public class HomePage : PageBase<HomePage> {
|
||||
|
||||
public Header Header { get; set; }
|
||||
public TitleSection TitleSection { get; set; }
|
||||
public FeaturesSection FeaturesSection { get; set; }
|
||||
public TestimonialsSection TestimonialsSection { get; set; }
|
||||
|
||||
16
webapi/Core/DomainObjects/Pages/ShopCartPage.cs
Normal file
16
webapi/Core/DomainObjects/Pages/ShopCartPage.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using Core.DomainObjects.PageSections;
|
||||
|
||||
namespace Core.DomainObjects.Pages {
|
||||
public class ShopCartPage : PageBase<ShopCartPage> {
|
||||
public Header Header { get; set; }
|
||||
|
||||
public TitleSection TitleSection { get; set; }
|
||||
|
||||
public ProductsSection ProductsSection { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,13 @@ using Core.DomainObjects.PageSections;
|
||||
|
||||
namespace Core.DomainObjects.Pages {
|
||||
public class ShopCatalogPage : PageBase<ShopCatalogPage> {
|
||||
|
||||
public Header Header { get; set; }
|
||||
|
||||
public TitleSection TitleSection { get; set; }
|
||||
|
||||
public ShopItemsSection ShopItemsSection { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
31
webapi/Core/DomainObjects/Pages/ShopCheckoutPage.cs
Normal file
31
webapi/Core/DomainObjects/Pages/ShopCheckoutPage.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using Core.DomainObjects.PageSections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.Pages {
|
||||
public class ShopCheckoutPage : PageBase<ShopCheckoutPage> {
|
||||
|
||||
public Header Header { get; set; }
|
||||
public TitleSection TitleSection { get; set; }
|
||||
|
||||
public BillingAddressSection BillingAddressSection { get; set; }
|
||||
|
||||
public ShippingAddressSection ShippingAddressSection { get; set; }
|
||||
|
||||
public SettingsSection SettingsSection { get; set; }
|
||||
|
||||
public SummarySection SummarySection { get; set; }
|
||||
|
||||
public PaymentSection PaymentSection { get; set; }
|
||||
|
||||
public FormItem Submit { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ using Core.DomainObjects.PageSections;
|
||||
namespace Core.DomainObjects.Pages {
|
||||
public class ShopItemPage : PageBase<ShopItemPage> {
|
||||
|
||||
public Header Header { get; set; }
|
||||
public ProductSection ProductSection { get; set; }
|
||||
|
||||
public RelatedProductsSection RelatedProductsSection { get; set; }
|
||||
|
||||
32
webapi/Core/DomainObjects/Pages/SignUpPage.cs
Normal file
32
webapi/Core/DomainObjects/Pages/SignUpPage.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.Pages {
|
||||
public class SignUpPage : PageBase<SignInPage> {
|
||||
|
||||
public Header Header { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public FormItem Username { get; set; }
|
||||
|
||||
public FormItem Email { get; set; }
|
||||
|
||||
public FormItem ReEmail { get; set; }
|
||||
public FormItem Password { get; set; }
|
||||
|
||||
public FormItem RePassword { get; set; }
|
||||
|
||||
public string AcceptTermsAndConditions { get; set; }
|
||||
|
||||
public FormItem Submit { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
webapi/Core/DomainObjects/Pages/SingInPage.cs
Normal file
28
webapi/Core/DomainObjects/Pages/SingInPage.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using Core.Abstractions.DomainObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.DomainObjects.Pages {
|
||||
public class SignInPage : PageBase<SignInPage> {
|
||||
|
||||
public Header Header { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public FormItem Email { get; set; }
|
||||
public FormItem Password { get; set; }
|
||||
|
||||
public string DontHaveAnAccount { get; set; }
|
||||
|
||||
public Link SignUpLink { get; set; }
|
||||
|
||||
public FormItem Submit { get; set; }
|
||||
|
||||
public override int GetHashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
24
webapi/Core/Enumerations/ReservedWords.cs
Normal file
24
webapi/Core/Enumerations/ReservedWords.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using Core.Abstractions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Core.Enumerations {
|
||||
public class ReservedWords : Enumeration {
|
||||
public static ReservedWords SiteName = new ReservedWords(0, "{siteName}" );
|
||||
public static ReservedWords SiteUrl = new ReservedWords(0, "{siteUrl}");
|
||||
public static ReservedWords Quantity = new ReservedWords(0, "{quantity}");
|
||||
public static ReservedWords ProductTitle = new ReservedWords(0, "{productTitle}");
|
||||
public static ReservedWords Currency = new ReservedWords(0, "{currency}");
|
||||
public static ReservedWords Date = new ReservedWords(0, "{date}");
|
||||
public static ReservedWords ReadTime = new ReservedWords(0, "{readTime}");
|
||||
public static ReservedWords BlogTitle = new ReservedWords(0, "{blogTitle}");
|
||||
public static ReservedWords NickName = new ReservedWords(0, "{nickName}");
|
||||
|
||||
private ReservedWords(int id, string name) : base(id, name) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ namespace DataProviders.Abstractions {
|
||||
.Find(predicate).ToList();
|
||||
}
|
||||
|
||||
return result != null
|
||||
return result != null && result.Count > 0
|
||||
? IDomainResult.Success(result)
|
||||
: IDomainResult.NotFound<List<T>?>();
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ namespace DataProviders {
|
||||
|
||||
public class ContentDataProvider : DataProviderBase<Content>, IContentDataProvider {
|
||||
|
||||
private const string _collectionName = "contents";
|
||||
private const string _collectionName = "content";
|
||||
public ContentDataProvider(
|
||||
ILogger<DataProviderBase<Content>> logger,
|
||||
IMongoClient client,
|
||||
@ -30,7 +30,7 @@ namespace DataProviders {
|
||||
public (Content?, IDomainResult) Get(Guid id) {
|
||||
var (list, result) = GetWithPredicate(x => x.Id == id, _collectionName);
|
||||
|
||||
if (!result.IsSuccess || list == null)
|
||||
if (!result.IsSuccess || list == null || list.Count == 0)
|
||||
return (null, result);
|
||||
|
||||
return (list.First(), result);
|
||||
|
||||
@ -3,7 +3,10 @@ using MongoDB.Bson.Serialization;
|
||||
using MongoDB.Bson.Serialization.Conventions;
|
||||
using MongoDB.Bson.Serialization.Serializers;
|
||||
|
||||
using DataProviders;
|
||||
using Core.DomainObjects;
|
||||
using Core.DomainObjects.Pages;
|
||||
using Core.DomainObjects.PageSections;
|
||||
using Core.DomainObjects.Documents;
|
||||
|
||||
namespace DataProviders {
|
||||
public class Mappings {
|
||||
@ -18,7 +21,295 @@ namespace DataProviders {
|
||||
// https://kevsoft.net/2020/06/25/storing-guids-as-strings-in-mongodb-with-csharp.html
|
||||
BsonSerializer.RegisterSerializer(new GuidSerializer(BsonType.String));
|
||||
|
||||
#region Primitives
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Address))) {
|
||||
BsonClassMap.RegisterClassMap<Address>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Author))) {
|
||||
BsonClassMap.RegisterClassMap<Author>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Category))) {
|
||||
BsonClassMap.RegisterClassMap<Category>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Comment))) {
|
||||
BsonClassMap.RegisterClassMap<Comment>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Contact))) {
|
||||
BsonClassMap.RegisterClassMap<Contact>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Feature))) {
|
||||
BsonClassMap.RegisterClassMap<Feature>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(FormItem))) {
|
||||
BsonClassMap.RegisterClassMap<FormItem>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Header))) {
|
||||
BsonClassMap.RegisterClassMap<Header>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Image))) {
|
||||
BsonClassMap.RegisterClassMap<Image>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Link))) {
|
||||
BsonClassMap.RegisterClassMap<Link>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Localization))) {
|
||||
BsonClassMap.RegisterClassMap<Localization>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(MenuItem))) {
|
||||
BsonClassMap.RegisterClassMap<MenuItem>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Reviewer))) {
|
||||
BsonClassMap.RegisterClassMap<Reviewer>(cm => {
|
||||
cm.AutoMap();
|
||||
|
||||
cm.SetIsRootClass(true);
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Route))) {
|
||||
BsonClassMap.RegisterClassMap<Route>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Testimonial))) {
|
||||
BsonClassMap.RegisterClassMap<Testimonial>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PageSections
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(BillingAddressSection))) {
|
||||
BsonClassMap.RegisterClassMap<BillingAddressSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(BlogTitleSection))) {
|
||||
BsonClassMap.RegisterClassMap<BlogTitleSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(CallToActionSection))) {
|
||||
BsonClassMap.RegisterClassMap<CallToActionSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(CommentsSection))) {
|
||||
BsonClassMap.RegisterClassMap<CommentsSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(FeaturedBlogsSection))) {
|
||||
BsonClassMap.RegisterClassMap<FeaturedBlogsSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(FeaturedBlogsSection))) {
|
||||
BsonClassMap.RegisterClassMap<FeaturedBlogsSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(FeaturesSection))) {
|
||||
BsonClassMap.RegisterClassMap<FeaturesSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(PaymentSection))) {
|
||||
BsonClassMap.RegisterClassMap<PaymentSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ProductSection))) {
|
||||
BsonClassMap.RegisterClassMap<ProductSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ProductsSection))) {
|
||||
BsonClassMap.RegisterClassMap<ProductsSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(RelatedProductsSection))) {
|
||||
BsonClassMap.RegisterClassMap<RelatedProductsSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(SettingsSection))) {
|
||||
BsonClassMap.RegisterClassMap<SettingsSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ShippingAddressSection))) {
|
||||
BsonClassMap.RegisterClassMap<ShippingAddressSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ShopItemsSection))) {
|
||||
BsonClassMap.RegisterClassMap<ShopItemsSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(SummarySection))) {
|
||||
BsonClassMap.RegisterClassMap<SummarySection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(TestimonialsSection))) {
|
||||
BsonClassMap.RegisterClassMap<TestimonialsSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(TitleSection))) {
|
||||
BsonClassMap.RegisterClassMap<TitleSection>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Pages
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(BlogCatalogPage))) {
|
||||
BsonClassMap.RegisterClassMap<BlogCatalogPage>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(BlogItemPage))) {
|
||||
BsonClassMap.RegisterClassMap<BlogItemPage>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(HomePage))) {
|
||||
BsonClassMap.RegisterClassMap<HomePage>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ShopCartPage))) {
|
||||
BsonClassMap.RegisterClassMap<ShopCartPage>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ShopCatalogPage))) {
|
||||
BsonClassMap.RegisterClassMap<ShopCatalogPage>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ShopCheckoutPage))) {
|
||||
BsonClassMap.RegisterClassMap<ShopCheckoutPage>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ShopItemPage))) {
|
||||
BsonClassMap.RegisterClassMap<ShopItemPage>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(SignInPage))) {
|
||||
BsonClassMap.RegisterClassMap<SignInPage>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(SignUpPage))) {
|
||||
BsonClassMap.RegisterClassMap<SignUpPage>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region BlogItem
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(BlogItem))) {
|
||||
BsonClassMap.RegisterClassMap<BlogItem>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Content
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Content))) {
|
||||
BsonClassMap.RegisterClassMap<Content>(cm => {
|
||||
cm.AutoMap();
|
||||
|
||||
//cm.GetMemberMap(c => c.Event)
|
||||
// .SetSerializer(new EnumerationSerializer<StateEvent>());
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ShopItem
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(ShopItem))) {
|
||||
BsonClassMap.RegisterClassMap<ShopItem>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region User
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(User))) {
|
||||
BsonClassMap.RegisterClassMap<User>(cm => {
|
||||
cm.AutoMap();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using DomainResults.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WeatherForecast.Models;
|
||||
using WeatherForecast.Models.Abstractions;
|
||||
using WeatherForecast.Models.Pages;
|
||||
using WeatherForecast.Models.PageSections;
|
||||
using WeatherForecast.Models.Responses;
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
@ -17,88 +19,94 @@ namespace WeatherForecast.Controllers;
|
||||
public class ContentController : ControllerBase {
|
||||
|
||||
private readonly ILogger<ContentController> _logger;
|
||||
private readonly IContentService _contentService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
public ContentController(
|
||||
ILogger<ContentController> logger
|
||||
ILogger<ContentController> logger,
|
||||
IContentService contentService
|
||||
) {
|
||||
_logger = logger;
|
||||
_contentService = contentService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public IActionResult Get([FromQuery] string? locale = "en-US") {
|
||||
[HttpGet("{siteId}")]
|
||||
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] string? locale = "en-US") {
|
||||
|
||||
var routes = new List<RouteModel> {
|
||||
new RouteModel ("/", "Home"),
|
||||
new RouteModel ("/home", "Home")
|
||||
};
|
||||
var result = _contentService.GetContent(siteId, locale);
|
||||
return result.ToActionResult();
|
||||
|
||||
var shopRoute = new RouteModel("/shop",
|
||||
new List<RouteModel> {
|
||||
new RouteModel ("", "ShopCatalog"),
|
||||
new RouteModel (":page", "ShopCatalog"),
|
||||
new RouteModel (":page", new List<RouteModel> {
|
||||
new RouteModel (":slug", "ShopItem")
|
||||
})
|
||||
});
|
||||
//var routes = new List<RouteModel> {
|
||||
// new RouteModel ("/", "Home"),
|
||||
// new RouteModel ("/home", "Home")
|
||||
//};
|
||||
|
||||
var blogRoute = new RouteModel("/blog",
|
||||
new List<RouteModel> {
|
||||
new RouteModel ("", "BlogCatalog"),
|
||||
new RouteModel (":page", "BlogCatalog"),
|
||||
new RouteModel (":page", new List<RouteModel> {
|
||||
new RouteModel (":slug", "BlogItem")
|
||||
})
|
||||
});
|
||||
//var shopRoute = new RouteModel("/shop",
|
||||
// new List<RouteModel> {
|
||||
// new RouteModel ("", "ShopCatalog"),
|
||||
// new RouteModel (":page", "ShopCatalog"),
|
||||
// new RouteModel (":page", new List<RouteModel> {
|
||||
// new RouteModel (":slug", "ShopItem")
|
||||
// })
|
||||
//});
|
||||
|
||||
routes.Add(shopRoute);
|
||||
routes.Add(blogRoute);
|
||||
//var blogRoute = new RouteModel("/blog",
|
||||
// new List<RouteModel> {
|
||||
// new RouteModel ("", "BlogCatalog"),
|
||||
// new RouteModel (":page", "BlogCatalog"),
|
||||
// new RouteModel (":page", new List<RouteModel> {
|
||||
// new RouteModel (":slug", "BlogItem")
|
||||
// })
|
||||
//});
|
||||
|
||||
var demoRoutes = new List<RouteModel> {
|
||||
new RouteModel ("/counter", "Counter"),
|
||||
new RouteModel ("/fetch-data", new List<RouteModel> {
|
||||
new RouteModel ("", "FetchData"),
|
||||
new RouteModel (":startDateIndex", "FetchData")
|
||||
})
|
||||
};
|
||||
//routes.Add(shopRoute);
|
||||
//routes.Add(blogRoute);
|
||||
|
||||
routes = routes.Concat(demoRoutes).ToList();
|
||||
//var demoRoutes = new List<RouteModel> {
|
||||
// new RouteModel ("/counter", "Counter"),
|
||||
// new RouteModel ("/fetch-data", new List<RouteModel> {
|
||||
// new RouteModel ("", "FetchData"),
|
||||
// new RouteModel (":startDateIndex", "FetchData")
|
||||
// })
|
||||
// };
|
||||
|
||||
var adminRoutes = new List<RouteModel> {
|
||||
new RouteModel ("/admin", "AdminHome")
|
||||
};
|
||||
//routes = routes.Concat(demoRoutes).ToList();
|
||||
|
||||
var serviceRoutes = new List<RouteModel> {
|
||||
new RouteModel ("/signin", "Signin"),
|
||||
new RouteModel ("/signup", "Signup"),
|
||||
new RouteModel ("*", "Error")
|
||||
};
|
||||
//var adminRoutes = new List<RouteModel> {
|
||||
// new RouteModel ("/admin", "AdminHome")
|
||||
//};
|
||||
|
||||
var topMenu = new List<MenuItemModel> {
|
||||
new MenuItemModel ("Home", "/"),
|
||||
new MenuItemModel ("Shop", "/shop"),
|
||||
new MenuItemModel ("Blog", "/blog"),
|
||||
new MenuItemModel ("Signin", "/signin"),
|
||||
new MenuItemModel ("Signout", "/signout")
|
||||
};
|
||||
//var serviceRoutes = new List<RouteModel> {
|
||||
// new RouteModel ("/signin", "Signin"),
|
||||
// new RouteModel ("/signup", "Signup"),
|
||||
// new RouteModel ("*", "Error")
|
||||
//};
|
||||
|
||||
var sideMenu = new List<MenuItemModel> {
|
||||
new MenuItemModel ("alert-triangle", "Home", "/admin"),
|
||||
new MenuItemModel ("activity", "Page", new List<MenuItemModel> {
|
||||
new MenuItemModel ("activity", "Page-1", "Page-1"),
|
||||
new MenuItemModel ("activity", "Page-2", "Page-2"),
|
||||
new MenuItemModel ("activity", "Page-3", "Page-3")
|
||||
}),
|
||||
new MenuItemModel ("Counter", "/counter"),
|
||||
new MenuItemModel ("Fetch data", "/fetch-data")
|
||||
};
|
||||
//var topMenu = new List<MenuItemModel> {
|
||||
// new MenuItemModel ("Home", "/"),
|
||||
// new MenuItemModel ("Shop", "/shop"),
|
||||
// new MenuItemModel ("Blog", "/blog"),
|
||||
// new MenuItemModel ("Signin", "/signin"),
|
||||
// new MenuItemModel ("Signout", "/signout")
|
||||
//};
|
||||
|
||||
//var sideMenu = new List<MenuItemModel> {
|
||||
// new MenuItemModel ("alert-triangle", "Home", "/admin"),
|
||||
// new MenuItemModel ("activity", "Page", new List<MenuItemModel> {
|
||||
// new MenuItemModel ("activity", "Page-1", "Page-1"),
|
||||
// new MenuItemModel ("activity", "Page-2", "Page-2"),
|
||||
// new MenuItemModel ("activity", "Page-3", "Page-3")
|
||||
// }),
|
||||
// new MenuItemModel ("Counter", "/counter"),
|
||||
// new MenuItemModel ("Fetch data", "/fetch-data")
|
||||
//};
|
||||
|
||||
|
||||
|
||||
@ -106,122 +114,122 @@ public class ContentController : ControllerBase {
|
||||
|
||||
|
||||
|
||||
var homePage = new HomePageModel {
|
||||
TitleSection = new TitleSectionModel {
|
||||
Title = "Hello, World! by C#",
|
||||
Text = @"
|
||||
<p>Welcome to your new single-page application, built with:</p>
|
||||
<ul>
|
||||
<li><a href='https://get.asp.net/'>ASP.NET Core</a> and <a href='https://msdn.microsoft.com/en-us/library/67ef8sbd.aspx'>C#</a> for cross-platform server-side code</li>
|
||||
<li><a href='https://facebook.github.io/react/'>React</a> and <a href='https://redux.js.org/'>Redux</a> for client-side code</li>
|
||||
<li><a href='https://getbootstrap.com/'>Bootstrap</a>, <a href='https://reactstrap.github.io/?path=/story/home-installation--page'>Reactstrap</a> and <a href=\""https://feathericons.com/\"">Feather icons</a> for layout and styling</li>
|
||||
</ul>",
|
||||
Image = new ImageModel { Src = "https://dummyimage.com/600x400/343a40/6c757d", Alt = "..." },
|
||||
PrimaryLink = new MenuItemModel("Get Started", "#features"),
|
||||
SecondaryLink = new MenuItemModel("Learn More", "#!")
|
||||
},
|
||||
//var homePage = new HomePageModel {
|
||||
// TitleSection = new TitleSectionModel {
|
||||
// Title = "Hello, World! by C#",
|
||||
// Text = @"
|
||||
// <p>Welcome to your new single-page application, built with:</p>
|
||||
// <ul>
|
||||
// <li><a href='https://get.asp.net/'>ASP.NET Core</a> and <a href='https://msdn.microsoft.com/en-us/library/67ef8sbd.aspx'>C#</a> for cross-platform server-side code</li>
|
||||
// <li><a href='https://facebook.github.io/react/'>React</a> and <a href='https://redux.js.org/'>Redux</a> for client-side code</li>
|
||||
// <li><a href='https://getbootstrap.com/'>Bootstrap</a>, <a href='https://reactstrap.github.io/?path=/story/home-installation--page'>Reactstrap</a> and <a href=\""https://feathericons.com/\"">Feather icons</a> for layout and styling</li>
|
||||
// </ul>",
|
||||
// Image = new ImageModel { Src = "https://dummyimage.com/600x400/343a40/6c757d", Alt = "..." },
|
||||
// PrimaryLink = new MenuItemModel("Get Started", "#features"),
|
||||
// SecondaryLink = new MenuItemModel("Learn More", "#!")
|
||||
// },
|
||||
|
||||
FeaturesSection = new FeaturesSectionModel {
|
||||
Title = "To help you get started, we have also set up:",
|
||||
Items = new List<FeatureModel> {
|
||||
new FeatureModel {
|
||||
Icon = "navigation",
|
||||
Title = "Client-side navigation",
|
||||
Text = "For example, click <em>Counter</em> then <em>Back</em> to return here."
|
||||
},
|
||||
new FeatureModel {
|
||||
Icon = "server",
|
||||
Title = "Development server integration",
|
||||
Text = "In development mode, the development server from <code>create-react-app</code> runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file."
|
||||
},
|
||||
new FeatureModel {
|
||||
Icon = "terminal",
|
||||
Title = "Efficient production builds",
|
||||
Text = "In production mode, development-time features are disabled, and your <code>dotnet publish</code> configuration produces minified, efficiently bundled JavaScript files."
|
||||
}
|
||||
}
|
||||
},
|
||||
TestimonialsSection = new TestimonialsSectionModel {
|
||||
Items = new List<TestimonialModel> {
|
||||
new TestimonialModel {
|
||||
Text = "The <code>ClientApp</code> subdirectory is a standard React application based on the <code>create-react-app</code> template. If you open a command prompt in that directory, you can run <code>yarn</code> commands such as <code>yarn test</code> or <code>yarn install</code>.",
|
||||
Reviewer = new ReviewerModel {
|
||||
Id = Guid.NewGuid(),
|
||||
Image = new ImageModel { Src = "https://dummyimage.com/40x40/ced4da/6c757d", Alt = "..." },
|
||||
FullName = "Admin",
|
||||
Position = "CEO, MAKS-IT"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
FeaturedBlogsSection = new FeaturedBologsSectionModel {
|
||||
Title = "From our blog"
|
||||
},
|
||||
// FeaturesSection = new FeaturesSectionModel {
|
||||
// Title = "To help you get started, we have also set up:",
|
||||
// Items = new List<FeatureModel> {
|
||||
// new FeatureModel {
|
||||
// Icon = "navigation",
|
||||
// Title = "Client-side navigation",
|
||||
// Text = "For example, click <em>Counter</em> then <em>Back</em> to return here."
|
||||
// },
|
||||
// new FeatureModel {
|
||||
// Icon = "server",
|
||||
// Title = "Development server integration",
|
||||
// Text = "In development mode, the development server from <code>create-react-app</code> runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file."
|
||||
// },
|
||||
// new FeatureModel {
|
||||
// Icon = "terminal",
|
||||
// Title = "Efficient production builds",
|
||||
// Text = "In production mode, development-time features are disabled, and your <code>dotnet publish</code> configuration produces minified, efficiently bundled JavaScript files."
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// TestimonialsSection = new TestimonialsSectionModel {
|
||||
// Items = new List<TestimonialModel> {
|
||||
// new TestimonialModel {
|
||||
// Text = "The <code>ClientApp</code> subdirectory is a standard React application based on the <code>create-react-app</code> template. If you open a command prompt in that directory, you can run <code>yarn</code> commands such as <code>yarn test</code> or <code>yarn install</code>.",
|
||||
// Reviewer = new ReviewerModel {
|
||||
// Id = Guid.NewGuid(),
|
||||
// Image = new ImageModel { Src = "https://dummyimage.com/40x40/ced4da/6c757d", Alt = "..." },
|
||||
// FullName = "Admin",
|
||||
// Position = "CEO, MAKS-IT"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// FeaturedBlogsSection = new FeaturedBologsSectionModel {
|
||||
// Title = "From our blog"
|
||||
// },
|
||||
|
||||
CallToActionSection = new CallToActionSectionModel {
|
||||
Title = "New products, delivered to you.",
|
||||
Text = "Sign up for our newsletter for the latest updates.",
|
||||
PrivacyDisclaimer = "We care about privacy, and will never share your data.",
|
||||
Email = new FormItemModel {
|
||||
PlaceHolder = "Email address...",
|
||||
Title = "Sign up"
|
||||
}
|
||||
}
|
||||
};
|
||||
// CallToActionSection = new CallToActionSectionModel {
|
||||
// Title = "New products, delivered to you.",
|
||||
// Text = "Sign up for our newsletter for the latest updates.",
|
||||
// PrivacyDisclaimer = "We care about privacy, and will never share your data.",
|
||||
// Email = new FormItemModel {
|
||||
// PlaceHolder = "Email address...",
|
||||
// Title = "Sign up"
|
||||
// }
|
||||
// }
|
||||
//};
|
||||
|
||||
var shopCatalogPage = new ShopCatalogPageModel {
|
||||
TitleSection = new TitleSectionModel {
|
||||
Title = "Shop in style",
|
||||
Text = "With this shop hompeage template"
|
||||
}
|
||||
};
|
||||
//var shopCatalogPage = new ShopCatalogPageModel {
|
||||
// TitleSection = new TitleSectionModel {
|
||||
// Title = "Shop in style",
|
||||
// Text = "With this shop hompeage template"
|
||||
// }
|
||||
//};
|
||||
|
||||
var shopItem = new ShopItemPageModel {
|
||||
ProductSection = new ProductSectionModel {
|
||||
AvailableQuantity = "Available Qty.",
|
||||
AddToCart = "Add to cart"
|
||||
},
|
||||
RelatedProductsSection = new RelatedProductsSectionModel {
|
||||
Title = "Related products"
|
||||
}
|
||||
};
|
||||
//var shopItem = new ShopItemPageModel {
|
||||
// ProductSection = new ProductSectionModel {
|
||||
// AvailableQuantity = "Available Qty.",
|
||||
// AddToCart = "Add to cart"
|
||||
// },
|
||||
// RelatedProductsSection = new RelatedProductsSectionModel {
|
||||
// Title = "Related products"
|
||||
// }
|
||||
//};
|
||||
|
||||
var blogCatalogPage = new BlogCatalogPageModel {
|
||||
TitleSection = new TitleSectionModel {
|
||||
Title = "Welcome to Blog Home!",
|
||||
Text = "A Bootstrap 5 starter layout for your next blog homepage"
|
||||
},
|
||||
FeaturedBlogSection = new FeaturedBlogSectionModel {
|
||||
ReadTime = "{date} Time to read: {readTime} min"
|
||||
}
|
||||
};
|
||||
//var blogCatalogPage = new BlogCatalogPageModel {
|
||||
// TitleSection = new TitleSectionModel {
|
||||
// Title = "Welcome to Blog Home!",
|
||||
// Text = "A Bootstrap 5 starter layout for your next blog homepage"
|
||||
// },
|
||||
// FeaturedBlogSection = new FeaturedBlogSectionModel {
|
||||
// ReadTime = "{date} Time to read: {readTime} min"
|
||||
// }
|
||||
//};
|
||||
|
||||
var blogItem = new BlogItemPageModel {
|
||||
TitleSection = new BlogTitleSectionModel {
|
||||
PostedOnBy = "Posted on {date} by {nickName}"
|
||||
},
|
||||
CommentsSection = new CommentsSectionModel {
|
||||
LeaveComment = "Join the discussion and leave a comment!"
|
||||
}
|
||||
};
|
||||
//var blogItem = new BlogItemPageModel {
|
||||
// TitleSection = new BlogTitleSectionModel {
|
||||
// PostedOnBy = "Posted on {date} by {nickName}"
|
||||
// },
|
||||
// CommentsSection = new CommentsSectionModel {
|
||||
// LeaveComment = "Join the discussion and leave a comment!"
|
||||
// }
|
||||
//};
|
||||
|
||||
return Ok(new GetContentResponseModel {
|
||||
SiteName = "MAKS-IT",
|
||||
//return Ok(new GetContentResponseModel {
|
||||
// SiteName = "MAKS-IT",
|
||||
|
||||
Routes = routes,
|
||||
AdminRoutes = adminRoutes,
|
||||
ServiceRoutes = serviceRoutes,
|
||||
// Routes = routes,
|
||||
// AdminRoutes = adminRoutes,
|
||||
// ServiceRoutes = serviceRoutes,
|
||||
|
||||
TopMenu = topMenu,
|
||||
SideMenu = sideMenu,
|
||||
// TopMenu = topMenu,
|
||||
// SideMenu = sideMenu,
|
||||
|
||||
HomePage = homePage,
|
||||
// HomePage = homePage,
|
||||
|
||||
ShopCatalog = shopCatalogPage,
|
||||
ShopItem = shopItem,
|
||||
// ShopCatalog = shopCatalogPage,
|
||||
// ShopItem = shopItem,
|
||||
|
||||
BlogCatalog = blogCatalogPage,
|
||||
Blogitem = blogItem
|
||||
});
|
||||
// BlogCatalog = blogCatalogPage,
|
||||
// Blogitem = blogItem
|
||||
//});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,37 @@
|
||||
namespace WeatherForecast.Services {
|
||||
using DataProviders;
|
||||
using DomainResults.Common;
|
||||
using ExtensionMethods;
|
||||
using WeatherForecast.Models.Responses;
|
||||
|
||||
namespace WeatherForecast.Services {
|
||||
|
||||
public interface IContentService {
|
||||
|
||||
(GetContentResponseModel?, IDomainResult) GetContent(Guid siteId, string? locale);
|
||||
}
|
||||
|
||||
|
||||
public class ContentService : IContentService {
|
||||
|
||||
private readonly ILogger<ContentService> _logger;
|
||||
private readonly IContentDataProvider _contentDataProvider;
|
||||
|
||||
public ContentService(
|
||||
ILogger<ContentService> logger,
|
||||
IContentDataProvider contentDataprovider
|
||||
) {
|
||||
_logger = logger;
|
||||
_contentDataProvider = contentDataprovider;
|
||||
}
|
||||
|
||||
public (GetContentResponseModel?, IDomainResult) GetContent(Guid siteId, string? locale) {
|
||||
var (content, result) = _contentDataProvider.Get("b3f39a82-6a1b-46a4-85cc-04c3b4315511".ToGuid());
|
||||
|
||||
if (!result.IsSuccess)
|
||||
return (null, result);
|
||||
|
||||
// map content to GetContentResponseModel
|
||||
|
||||
return IDomainResult.Failed<GetContentResponseModel?>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using WeatherForecast.Services;
|
||||
using DataProviders.Extensions;
|
||||
|
||||
namespace WeatherForecast {
|
||||
public class Startup {
|
||||
@ -55,6 +57,10 @@ namespace WeatherForecast {
|
||||
// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-context?view=aspnetcore-3.1#use-httpcontext-from-custom-components
|
||||
services.AddHttpContextAccessor();
|
||||
|
||||
services.AddScoped<IContentService, ContentService>();
|
||||
|
||||
services.RegisterDataproviders(appSettings);
|
||||
|
||||
#region Swagger
|
||||
services.ConfigureSwaggerGen(options => {
|
||||
// your custom configuration goes here
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DomainResult" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.5" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
@ -21,6 +22,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Core\Core.csproj" />
|
||||
<ProjectReference Include="..\DataProviders\DataProviders.csproj" />
|
||||
<ProjectReference Include="..\Extensions\Extensions.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -7,6 +7,11 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"Configuration": {
|
||||
"Secret": "TUlJQ1d3SUJBQUtCZ0djczU2dnIzTWRwa0VYczYvYjIyemxMWlhSaFdrSWtyN0dqUHB4ZkNpQk9FU2Q3L2VxcA=="
|
||||
"Secret": "TUlJQ1d3SUJBQUtCZ0djczU2dnIzTWRwa0VYczYvYjIyemxMWlhSaFdrSWtyN0dqUHB4ZkNpQk9FU2Q3L2VxcA==",
|
||||
|
||||
"Database": {
|
||||
"ConnectionString": "mongodb://localhost:27017"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user