(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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Core.Entities {
|
namespace Core.DomainObjects {
|
||||||
public class Address {
|
public class Address {
|
||||||
public string Street { get; set; }
|
public string Street { get; set; }
|
||||||
public string City { 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.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Core.Entities {
|
namespace Core.DomainObjects {
|
||||||
public class Contact {
|
public class Contact {
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
public bool IsConfirmed { get; set; }
|
public bool IsConfirmed { get; set; }
|
||||||
@ -3,8 +3,9 @@
|
|||||||
namespace Core.DomainObjects.Documents {
|
namespace Core.DomainObjects.Documents {
|
||||||
public class BlogItem : PostItemBase<BlogItem> {
|
public class BlogItem : PostItemBase<BlogItem> {
|
||||||
|
|
||||||
public int Likes { get; set; }
|
public int? ReadTime { get; set; }
|
||||||
public int ReadingTime { get; set; }
|
|
||||||
|
public int? Likes { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@ -5,6 +5,8 @@ namespace Core.DomainObjects.Documents {
|
|||||||
|
|
||||||
public class Content : DomainObjectDocumentBase<Content> {
|
public class Content : DomainObjectDocumentBase<Content> {
|
||||||
|
|
||||||
|
public Guid SiteId { get; set; }
|
||||||
|
|
||||||
public string SiteName { get; set; }
|
public string SiteName { get; set; }
|
||||||
public string SiteUrl { get; set; }
|
public string SiteUrl { get; set; }
|
||||||
|
|
||||||
@ -23,9 +25,15 @@ namespace Core.DomainObjects.Documents {
|
|||||||
|
|
||||||
public ShopCatalogPage ShopCatalog { get; set; }
|
public ShopCatalogPage ShopCatalog { get; set; }
|
||||||
public ShopItemPage ShopItem { get; set; }
|
public ShopItemPage ShopItem { get; set; }
|
||||||
|
public ShopCartPage ShopCart { get; set; }
|
||||||
|
public ShopCheckoutPage ShopCheckout { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public BlogCatalogPage BlogCatalog { 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() {
|
public override int GetHashCode() {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using Core.Abstractions;
|
using Core.Abstractions;
|
||||||
using Core.Abstractions.DomainObjects;
|
using Core.Abstractions.DomainObjects;
|
||||||
using Core.Entities;
|
using Core.DomainObjects;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|||||||
@ -8,6 +8,8 @@ using System.Threading.Tasks;
|
|||||||
namespace Core.DomainObjects {
|
namespace Core.DomainObjects {
|
||||||
public class FormItem : DomainObjectBase<FormItem> {
|
public class FormItem : DomainObjectBase<FormItem> {
|
||||||
public string? Title { get; set; }
|
public string? Title { get; set; }
|
||||||
|
|
||||||
|
public string? Optional { get; set; }
|
||||||
public string? PlaceHolder { get; set; }
|
public string? PlaceHolder { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
|
|||||||
@ -3,11 +3,11 @@
|
|||||||
namespace Core.DomainObjects {
|
namespace Core.DomainObjects {
|
||||||
public class Header : DomainObjectBase<Header> {
|
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() {
|
public override int GetHashCode() {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@ -8,17 +8,17 @@ using System.Threading.Tasks;
|
|||||||
namespace Core.DomainObjects {
|
namespace Core.DomainObjects {
|
||||||
public class Localization : DomainObjectBase<Localization> {
|
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() {
|
public override int GetHashCode() {
|
||||||
throw new NotImplementedException();
|
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;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Core.DomainObjects.PageSections {
|
namespace Core.DomainObjects.PageSections {
|
||||||
public class FeaturedBlogSection : PageSectionBase<FeaturedBlogSection> {
|
public class FeaturedBlogsSection : PageSectionBase<FeaturedBlogsSection> {
|
||||||
public string ReadTime { get; set; }
|
public string ReadTime { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
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 {
|
namespace Core.DomainObjects.PageSections {
|
||||||
public class RelatedProductsSection : PageSectionBase<RelatedProductsSection> {
|
public class RelatedProductsSection : PageSectionBase<RelatedProductsSection> {
|
||||||
|
|
||||||
|
public string AddToCart { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
throw new NotImplementedException();
|
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 {
|
namespace Core.DomainObjects.Pages {
|
||||||
public class BlogCatalogPage : PageBase<BlogCatalogPage> {
|
public class BlogCatalogPage : PageBase<BlogCatalogPage> {
|
||||||
|
|
||||||
|
public Header Header { get; set; }
|
||||||
|
|
||||||
public TitleSection TitleSection { get; set; }
|
public TitleSection TitleSection { get; set; }
|
||||||
public FeaturedBlogSection FeaturedBlogSection { get; set; }
|
public FeaturedBlogsSection FeaturedBlogSection { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@ -3,6 +3,8 @@ using Core.DomainObjects.PageSections;
|
|||||||
|
|
||||||
namespace Core.DomainObjects.Pages {
|
namespace Core.DomainObjects.Pages {
|
||||||
public class BlogItemPage : PageBase<BlogItemPage> {
|
public class BlogItemPage : PageBase<BlogItemPage> {
|
||||||
|
|
||||||
|
public Header Header { get; set; }
|
||||||
public BlogTitleSection TitleSection { get; set; }
|
public BlogTitleSection TitleSection { get; set; }
|
||||||
public CommentsSection CommentsSection { get; set; }
|
public CommentsSection CommentsSection { get; set; }
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using Core.DomainObjects.PageSections;
|
|||||||
namespace Core.DomainObjects.Pages {
|
namespace Core.DomainObjects.Pages {
|
||||||
public class HomePage : PageBase<HomePage> {
|
public class HomePage : PageBase<HomePage> {
|
||||||
|
|
||||||
|
public Header Header { get; set; }
|
||||||
public TitleSection TitleSection { get; set; }
|
public TitleSection TitleSection { get; set; }
|
||||||
public FeaturesSection FeaturesSection { get; set; }
|
public FeaturesSection FeaturesSection { get; set; }
|
||||||
public TestimonialsSection TestimonialsSection { 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 {
|
namespace Core.DomainObjects.Pages {
|
||||||
public class ShopCatalogPage : PageBase<ShopCatalogPage> {
|
public class ShopCatalogPage : PageBase<ShopCatalogPage> {
|
||||||
|
|
||||||
|
public Header Header { get; set; }
|
||||||
|
|
||||||
public TitleSection TitleSection { get; set; }
|
public TitleSection TitleSection { get; set; }
|
||||||
|
|
||||||
|
public ShopItemsSection ShopItemsSection { get; set; }
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
throw new NotImplementedException();
|
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 {
|
namespace Core.DomainObjects.Pages {
|
||||||
public class ShopItemPage : PageBase<ShopItemPage> {
|
public class ShopItemPage : PageBase<ShopItemPage> {
|
||||||
|
|
||||||
|
public Header Header { get; set; }
|
||||||
public ProductSection ProductSection { get; set; }
|
public ProductSection ProductSection { get; set; }
|
||||||
|
|
||||||
public RelatedProductsSection RelatedProductsSection { 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();
|
.Find(predicate).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result != null
|
return result != null && result.Count > 0
|
||||||
? IDomainResult.Success(result)
|
? IDomainResult.Success(result)
|
||||||
: IDomainResult.NotFound<List<T>?>();
|
: IDomainResult.NotFound<List<T>?>();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ namespace DataProviders {
|
|||||||
|
|
||||||
public class ContentDataProvider : DataProviderBase<Content>, IContentDataProvider {
|
public class ContentDataProvider : DataProviderBase<Content>, IContentDataProvider {
|
||||||
|
|
||||||
private const string _collectionName = "contents";
|
private const string _collectionName = "content";
|
||||||
public ContentDataProvider(
|
public ContentDataProvider(
|
||||||
ILogger<DataProviderBase<Content>> logger,
|
ILogger<DataProviderBase<Content>> logger,
|
||||||
IMongoClient client,
|
IMongoClient client,
|
||||||
@ -30,7 +30,7 @@ namespace DataProviders {
|
|||||||
public (Content?, IDomainResult) Get(Guid id) {
|
public (Content?, IDomainResult) Get(Guid id) {
|
||||||
var (list, result) = GetWithPredicate(x => x.Id == id, _collectionName);
|
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 (null, result);
|
||||||
|
|
||||||
return (list.First(), result);
|
return (list.First(), result);
|
||||||
|
|||||||
@ -3,7 +3,10 @@ using MongoDB.Bson.Serialization;
|
|||||||
using MongoDB.Bson.Serialization.Conventions;
|
using MongoDB.Bson.Serialization.Conventions;
|
||||||
using MongoDB.Bson.Serialization.Serializers;
|
using MongoDB.Bson.Serialization.Serializers;
|
||||||
|
|
||||||
using DataProviders;
|
using Core.DomainObjects;
|
||||||
|
using Core.DomainObjects.Pages;
|
||||||
|
using Core.DomainObjects.PageSections;
|
||||||
|
using Core.DomainObjects.Documents;
|
||||||
|
|
||||||
namespace DataProviders {
|
namespace DataProviders {
|
||||||
public class Mappings {
|
public class Mappings {
|
||||||
@ -18,7 +21,295 @@ namespace DataProviders {
|
|||||||
// https://kevsoft.net/2020/06/25/storing-guids-as-strings-in-mongodb-with-csharp.html
|
// https://kevsoft.net/2020/06/25/storing-guids-as-strings-in-mongodb-with-csharp.html
|
||||||
BsonSerializer.RegisterSerializer(new GuidSerializer(BsonType.String));
|
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 Microsoft.AspNetCore.Mvc;
|
||||||
using WeatherForecast.Models;
|
using WeatherForecast.Models;
|
||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
using WeatherForecast.Models.Pages;
|
using WeatherForecast.Models.Pages;
|
||||||
using WeatherForecast.Models.PageSections;
|
using WeatherForecast.Models.PageSections;
|
||||||
using WeatherForecast.Models.Responses;
|
using WeatherForecast.Models.Responses;
|
||||||
|
using WeatherForecast.Services;
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers;
|
namespace WeatherForecast.Controllers;
|
||||||
|
|
||||||
@ -17,88 +19,94 @@ namespace WeatherForecast.Controllers;
|
|||||||
public class ContentController : ControllerBase {
|
public class ContentController : ControllerBase {
|
||||||
|
|
||||||
private readonly ILogger<ContentController> _logger;
|
private readonly ILogger<ContentController> _logger;
|
||||||
|
private readonly IContentService _contentService;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger"></param>
|
/// <param name="logger"></param>
|
||||||
public ContentController(
|
public ContentController(
|
||||||
ILogger<ContentController> logger
|
ILogger<ContentController> logger,
|
||||||
|
IContentService contentService
|
||||||
) {
|
) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_contentService = contentService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet("{siteId}")]
|
||||||
public IActionResult Get([FromQuery] string? locale = "en-US") {
|
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] string? locale = "en-US") {
|
||||||
|
|
||||||
var routes = new List<RouteModel> {
|
var result = _contentService.GetContent(siteId, locale);
|
||||||
new RouteModel ("/", "Home"),
|
return result.ToActionResult();
|
||||||
new RouteModel ("/home", "Home")
|
|
||||||
};
|
|
||||||
|
|
||||||
var shopRoute = new RouteModel("/shop",
|
//var routes = new List<RouteModel> {
|
||||||
new List<RouteModel> {
|
// new RouteModel ("/", "Home"),
|
||||||
new RouteModel ("", "ShopCatalog"),
|
// new RouteModel ("/home", "Home")
|
||||||
new RouteModel (":page", "ShopCatalog"),
|
//};
|
||||||
new RouteModel (":page", new List<RouteModel> {
|
|
||||||
new RouteModel (":slug", "ShopItem")
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
var blogRoute = new RouteModel("/blog",
|
//var shopRoute = new RouteModel("/shop",
|
||||||
new List<RouteModel> {
|
// new List<RouteModel> {
|
||||||
new RouteModel ("", "BlogCatalog"),
|
// new RouteModel ("", "ShopCatalog"),
|
||||||
new RouteModel (":page", "BlogCatalog"),
|
// new RouteModel (":page", "ShopCatalog"),
|
||||||
new RouteModel (":page", new List<RouteModel> {
|
// new RouteModel (":page", new List<RouteModel> {
|
||||||
new RouteModel (":slug", "BlogItem")
|
// new RouteModel (":slug", "ShopItem")
|
||||||
})
|
// })
|
||||||
});
|
//});
|
||||||
|
|
||||||
routes.Add(shopRoute);
|
//var blogRoute = new RouteModel("/blog",
|
||||||
routes.Add(blogRoute);
|
// 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> {
|
//routes.Add(shopRoute);
|
||||||
new RouteModel ("/counter", "Counter"),
|
//routes.Add(blogRoute);
|
||||||
new RouteModel ("/fetch-data", new List<RouteModel> {
|
|
||||||
new RouteModel ("", "FetchData"),
|
|
||||||
new RouteModel (":startDateIndex", "FetchData")
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
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> {
|
//routes = routes.Concat(demoRoutes).ToList();
|
||||||
new RouteModel ("/admin", "AdminHome")
|
|
||||||
};
|
|
||||||
|
|
||||||
var serviceRoutes = new List<RouteModel> {
|
//var adminRoutes = new List<RouteModel> {
|
||||||
new RouteModel ("/signin", "Signin"),
|
// new RouteModel ("/admin", "AdminHome")
|
||||||
new RouteModel ("/signup", "Signup"),
|
//};
|
||||||
new RouteModel ("*", "Error")
|
|
||||||
};
|
|
||||||
|
|
||||||
var topMenu = new List<MenuItemModel> {
|
//var serviceRoutes = new List<RouteModel> {
|
||||||
new MenuItemModel ("Home", "/"),
|
// new RouteModel ("/signin", "Signin"),
|
||||||
new MenuItemModel ("Shop", "/shop"),
|
// new RouteModel ("/signup", "Signup"),
|
||||||
new MenuItemModel ("Blog", "/blog"),
|
// new RouteModel ("*", "Error")
|
||||||
new MenuItemModel ("Signin", "/signin"),
|
//};
|
||||||
new MenuItemModel ("Signout", "/signout")
|
|
||||||
};
|
|
||||||
|
|
||||||
var sideMenu = new List<MenuItemModel> {
|
//var topMenu = new List<MenuItemModel> {
|
||||||
new MenuItemModel ("alert-triangle", "Home", "/admin"),
|
// new MenuItemModel ("Home", "/"),
|
||||||
new MenuItemModel ("activity", "Page", new List<MenuItemModel> {
|
// new MenuItemModel ("Shop", "/shop"),
|
||||||
new MenuItemModel ("activity", "Page-1", "Page-1"),
|
// new MenuItemModel ("Blog", "/blog"),
|
||||||
new MenuItemModel ("activity", "Page-2", "Page-2"),
|
// new MenuItemModel ("Signin", "/signin"),
|
||||||
new MenuItemModel ("activity", "Page-3", "Page-3")
|
// new MenuItemModel ("Signout", "/signout")
|
||||||
}),
|
//};
|
||||||
new MenuItemModel ("Counter", "/counter"),
|
|
||||||
new MenuItemModel ("Fetch data", "/fetch-data")
|
//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 {
|
//var homePage = new HomePageModel {
|
||||||
TitleSection = new TitleSectionModel {
|
// TitleSection = new TitleSectionModel {
|
||||||
Title = "Hello, World! by C#",
|
// Title = "Hello, World! by C#",
|
||||||
Text = @"
|
// Text = @"
|
||||||
<p>Welcome to your new single-page application, built with:</p>
|
// <p>Welcome to your new single-page application, built with:</p>
|
||||||
<ul>
|
// <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://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://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>
|
// <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>",
|
// </ul>",
|
||||||
Image = new ImageModel { Src = "https://dummyimage.com/600x400/343a40/6c757d", Alt = "..." },
|
// Image = new ImageModel { Src = "https://dummyimage.com/600x400/343a40/6c757d", Alt = "..." },
|
||||||
PrimaryLink = new MenuItemModel("Get Started", "#features"),
|
// PrimaryLink = new MenuItemModel("Get Started", "#features"),
|
||||||
SecondaryLink = new MenuItemModel("Learn More", "#!")
|
// SecondaryLink = new MenuItemModel("Learn More", "#!")
|
||||||
},
|
// },
|
||||||
|
|
||||||
FeaturesSection = new FeaturesSectionModel {
|
// FeaturesSection = new FeaturesSectionModel {
|
||||||
Title = "To help you get started, we have also set up:",
|
// Title = "To help you get started, we have also set up:",
|
||||||
Items = new List<FeatureModel> {
|
// Items = new List<FeatureModel> {
|
||||||
new FeatureModel {
|
// new FeatureModel {
|
||||||
Icon = "navigation",
|
// Icon = "navigation",
|
||||||
Title = "Client-side navigation",
|
// Title = "Client-side navigation",
|
||||||
Text = "For example, click <em>Counter</em> then <em>Back</em> to return here."
|
// Text = "For example, click <em>Counter</em> then <em>Back</em> to return here."
|
||||||
},
|
// },
|
||||||
new FeatureModel {
|
// new FeatureModel {
|
||||||
Icon = "server",
|
// Icon = "server",
|
||||||
Title = "Development server integration",
|
// 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."
|
// 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 {
|
// new FeatureModel {
|
||||||
Icon = "terminal",
|
// Icon = "terminal",
|
||||||
Title = "Efficient production builds",
|
// 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."
|
// 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 {
|
// TestimonialsSection = new TestimonialsSectionModel {
|
||||||
Items = new List<TestimonialModel> {
|
// Items = new List<TestimonialModel> {
|
||||||
new 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>.",
|
// 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 {
|
// Reviewer = new ReviewerModel {
|
||||||
Id = Guid.NewGuid(),
|
// Id = Guid.NewGuid(),
|
||||||
Image = new ImageModel { Src = "https://dummyimage.com/40x40/ced4da/6c757d", Alt = "..." },
|
// Image = new ImageModel { Src = "https://dummyimage.com/40x40/ced4da/6c757d", Alt = "..." },
|
||||||
FullName = "Admin",
|
// FullName = "Admin",
|
||||||
Position = "CEO, MAKS-IT"
|
// Position = "CEO, MAKS-IT"
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
FeaturedBlogsSection = new FeaturedBologsSectionModel {
|
// FeaturedBlogsSection = new FeaturedBologsSectionModel {
|
||||||
Title = "From our blog"
|
// Title = "From our blog"
|
||||||
},
|
// },
|
||||||
|
|
||||||
CallToActionSection = new CallToActionSectionModel {
|
// CallToActionSection = new CallToActionSectionModel {
|
||||||
Title = "New products, delivered to you.",
|
// Title = "New products, delivered to you.",
|
||||||
Text = "Sign up for our newsletter for the latest updates.",
|
// Text = "Sign up for our newsletter for the latest updates.",
|
||||||
PrivacyDisclaimer = "We care about privacy, and will never share your data.",
|
// PrivacyDisclaimer = "We care about privacy, and will never share your data.",
|
||||||
Email = new FormItemModel {
|
// Email = new FormItemModel {
|
||||||
PlaceHolder = "Email address...",
|
// PlaceHolder = "Email address...",
|
||||||
Title = "Sign up"
|
// Title = "Sign up"
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
};
|
//};
|
||||||
|
|
||||||
var shopCatalogPage = new ShopCatalogPageModel {
|
//var shopCatalogPage = new ShopCatalogPageModel {
|
||||||
TitleSection = new TitleSectionModel {
|
// TitleSection = new TitleSectionModel {
|
||||||
Title = "Shop in style",
|
// Title = "Shop in style",
|
||||||
Text = "With this shop hompeage template"
|
// Text = "With this shop hompeage template"
|
||||||
}
|
// }
|
||||||
};
|
//};
|
||||||
|
|
||||||
var shopItem = new ShopItemPageModel {
|
//var shopItem = new ShopItemPageModel {
|
||||||
ProductSection = new ProductSectionModel {
|
// ProductSection = new ProductSectionModel {
|
||||||
AvailableQuantity = "Available Qty.",
|
// AvailableQuantity = "Available Qty.",
|
||||||
AddToCart = "Add to cart"
|
// AddToCart = "Add to cart"
|
||||||
},
|
// },
|
||||||
RelatedProductsSection = new RelatedProductsSectionModel {
|
// RelatedProductsSection = new RelatedProductsSectionModel {
|
||||||
Title = "Related products"
|
// Title = "Related products"
|
||||||
}
|
// }
|
||||||
};
|
//};
|
||||||
|
|
||||||
var blogCatalogPage = new BlogCatalogPageModel {
|
//var blogCatalogPage = new BlogCatalogPageModel {
|
||||||
TitleSection = new TitleSectionModel {
|
// TitleSection = new TitleSectionModel {
|
||||||
Title = "Welcome to Blog Home!",
|
// Title = "Welcome to Blog Home!",
|
||||||
Text = "A Bootstrap 5 starter layout for your next blog homepage"
|
// Text = "A Bootstrap 5 starter layout for your next blog homepage"
|
||||||
},
|
// },
|
||||||
FeaturedBlogSection = new FeaturedBlogSectionModel {
|
// FeaturedBlogSection = new FeaturedBlogSectionModel {
|
||||||
ReadTime = "{date} Time to read: {readTime} min"
|
// ReadTime = "{date} Time to read: {readTime} min"
|
||||||
}
|
// }
|
||||||
};
|
//};
|
||||||
|
|
||||||
var blogItem = new BlogItemPageModel {
|
//var blogItem = new BlogItemPageModel {
|
||||||
TitleSection = new BlogTitleSectionModel {
|
// TitleSection = new BlogTitleSectionModel {
|
||||||
PostedOnBy = "Posted on {date} by {nickName}"
|
// PostedOnBy = "Posted on {date} by {nickName}"
|
||||||
},
|
// },
|
||||||
CommentsSection = new CommentsSectionModel {
|
// CommentsSection = new CommentsSectionModel {
|
||||||
LeaveComment = "Join the discussion and leave a comment!"
|
// LeaveComment = "Join the discussion and leave a comment!"
|
||||||
}
|
// }
|
||||||
};
|
//};
|
||||||
|
|
||||||
return Ok(new GetContentResponseModel {
|
//return Ok(new GetContentResponseModel {
|
||||||
SiteName = "MAKS-IT",
|
// SiteName = "MAKS-IT",
|
||||||
|
|
||||||
Routes = routes,
|
// Routes = routes,
|
||||||
AdminRoutes = adminRoutes,
|
// AdminRoutes = adminRoutes,
|
||||||
ServiceRoutes = serviceRoutes,
|
// ServiceRoutes = serviceRoutes,
|
||||||
|
|
||||||
TopMenu = topMenu,
|
// TopMenu = topMenu,
|
||||||
SideMenu = sideMenu,
|
// SideMenu = sideMenu,
|
||||||
|
|
||||||
HomePage = homePage,
|
// HomePage = homePage,
|
||||||
|
|
||||||
ShopCatalog = shopCatalogPage,
|
// ShopCatalog = shopCatalogPage,
|
||||||
ShopItem = shopItem,
|
// ShopItem = shopItem,
|
||||||
|
|
||||||
BlogCatalog = blogCatalogPage,
|
// BlogCatalog = blogCatalogPage,
|
||||||
Blogitem = blogItem
|
// 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 {
|
public interface IContentService {
|
||||||
|
(GetContentResponseModel?, IDomainResult) GetContent(Guid siteId, string? locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ContentService : IContentService {
|
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.OpenApi.Models;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
|
using WeatherForecast.Services;
|
||||||
|
using DataProviders.Extensions;
|
||||||
|
|
||||||
namespace WeatherForecast {
|
namespace WeatherForecast {
|
||||||
public class Startup {
|
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
|
// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-context?view=aspnetcore-3.1#use-httpcontext-from-custom-components
|
||||||
services.AddHttpContextAccessor();
|
services.AddHttpContextAccessor();
|
||||||
|
|
||||||
|
services.AddScoped<IContentService, ContentService>();
|
||||||
|
|
||||||
|
services.RegisterDataproviders(appSettings);
|
||||||
|
|
||||||
#region Swagger
|
#region Swagger
|
||||||
services.ConfigureSwaggerGen(options => {
|
services.ConfigureSwaggerGen(options => {
|
||||||
// your custom configuration goes here
|
// your custom configuration goes here
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DomainResult" Version="3.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.5" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||||
@ -21,6 +22,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Core\Core.csproj" />
|
<ProjectReference Include="..\Core\Core.csproj" />
|
||||||
<ProjectReference Include="..\DataProviders\DataProviders.csproj" />
|
<ProjectReference Include="..\DataProviders\DataProviders.csproj" />
|
||||||
|
<ProjectReference Include="..\Extensions\Extensions.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -7,6 +7,11 @@
|
|||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"Configuration": {
|
"Configuration": {
|
||||||
"Secret": "TUlJQ1d3SUJBQUtCZ0djczU2dnIzTWRwa0VYczYvYjIyemxMWlhSaFdrSWtyN0dqUHB4ZkNpQk9FU2Q3L2VxcA=="
|
"Secret": "TUlJQ1d3SUJBQUtCZ0djczU2dnIzTWRwa0VYczYvYjIyemxMWlhSaFdrSWtyN0dqUHB4ZkNpQk9FU2Q3L2VxcA==",
|
||||||
|
|
||||||
|
"Database": {
|
||||||
|
"ConnectionString": "mongodb://localhost:27017"
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user