diff --git a/db/DML/content.json b/db/DML/content.json new file mode 100644 index 0000000..b8f4bc9 --- /dev/null +++ b/db/DML/content.json @@ -0,0 +1,499 @@ +{ + "_id": "b3f39a82-6a1b-46a4-85cc-04c3b4315511", + "siteId": "404c8232-9048-4519-bfba-6e78dc7005ca", + "siteName": "MAKS-IT", + "siteUrl": "https://maks-it.com", + "header": { + "title": "{siteName}", + "meta": { + "chartset": "utf-8", + "google-site-verification": "", + "description": "Single-page application home page" + }, + "link": { + "canonical": "{siteUrl}" + } + }, + "localization": { + "timeZone": "+1", + "locale": "en-US", + "dateFormat": "MMMM YYYY, dddd", + "timeFormat": "HH:mm", + "currency": "EUR", + "currencySymbol": "€" + }, + "routes": [ + { + "target": "/", + "component": "Home" + }, + { + "target": "/home", + "component": "Home" + }, + { + "target": "/shop", + "childRoutes": [ + { + "target": "", + "component": "ShopCatalog" + }, + { + "target": ":page", + "component": "ShopCatalog" + }, + { + "target": ":page", + "childRoutes": [ + { + "target": ":slug", + "component": "ShopItem" + } + ] + }, + { + "target": "cart", + "childRoutes": [ + { + "target": "", + "component": "Cart" + }, + { + "target": "checkout", + "component": "Checkout" + } + ] + } + ] + }, + { + "target": "/blog", + "childRoutes": [ + { + "target": "", + "component": "BlogCatalog" + }, + { + "target": ":page", + "component": "BlogCatalog" + }, + { + "target": ":page", + "childRoutes": [ + { + "target": ":slug", + "component": "BlogItem" + } + ] + } + ] + } + ], + "adminRoutes": [], + "serviceRoutes": [ + { + "target": "/signin", + "component": "Signin" + }, + { + "target": "/signup", + "component": "Signup" + } + ], + "topMenu": [ + { + "target": "/", + "title": "Home" + }, + { + "target": "/shop", + "title": "Shop" + }, + { + "target": "/blog", + "title": "Blog" + }, + { + "target": "/signin", + "title": "Sing in" + }, + { + "target": "/signup", + "title": "Sign up" + }, + { + "target": "/shop/cart", + "icon": "shopping-cart", + "title": "Cart ({quantity})" + } + ], + "sideMenu": [], + "homePage": { + "header": { + "title": "Home - {siteName}", + "meta": { + "description": "Single-page application home page" + }, + "link": { + "canonical": "{siteUrl}" + } + }, + "titleSection": { + "title": "Hello, World! by Redux", + "text": "

Welcome to your new single-page application, built with:

\n ", + + "primaryLink": { + "target": "#!", + "anchorText": "Get Started" + }, + "secondaryLink": { + "target": "#!", + "anchorText": "Learn more" + }, + + "image": { + "src": "https://dummyimage.com/600x400/343a40/6c757d", + "alt": "..." + } + }, + "featuresSection": { + "title": "To help you get started, we have also set up:", + "items": [ + { + "icon": "navigation", + "title": "Client-side navigation", + "text": "For example, click Counter then Back to return here." + }, + { + "icon": "server", + "title": "Development server integration", + "text": "In development mode, the development server from create-react-app runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file." + }, + { + "icon": "terminal", + "title": "Efficient production builds", + "text": "In production mode, development-time features are disabled, and your dotnet publish configuration produces minified, efficiently bundled JavaScript files." + } + ] + }, + "testimonialsSection": { + "items": [ + { + "text": "The ClientApp subdirectory is a standard React application based on the create-react-app template. If you open a command prompt in that directory, you can run yarn commands such as yarn test or yarn install.", + "reviewer": { + "_id": "c5295208-8950-441f-8217-bd7c4a907a0f", + "image": { + "src": "https://dummyimage.com/40x40/ced4da/6c757d", + "alt": "..." + }, + "fullName": "Admin", + "position": "CEO, MAKS-IT" + } + } + ] + }, + "featuredBlogsSection": { + "title": "Featured blogs" + }, + "callToActionSection": { + "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": { + "title": "Sign up", + "placeHolder": "Email address..." + } + } + }, + "shopCatalog": { + "header": { + "title": "Shop catalog - {siteName}", + "meta": { + "description": "Single-page application shop catalog" + }, + "link": { + "canonical": "" + } + }, + "titleSection": { + "title": "Shop in style", + "text": "With this shop hompeage template" + }, + "shopItemsSection": { + "addToCart": "Add to cart" + } + }, + "shopItem": { + "header": { + "title": "{productTitle} - {siteName}", + "meta": { + "description": "Single-page application shop item" + }, + "link": { + "canonical": "" + } + }, + "productSection": { + "availableQuantity": "Available Qty.", + "addToCart": "Add to cart" + }, + "relatedProductsSection": { + "title": "Related products", + "addToCart": "Add to cart" + } + }, + "shopCart": { + "header": { + "title": "Shop cart - {siteName}", + "meta": { + "description": "Single-page application shop cart" + }, + "link": { + "canonical": "" + } + }, + "titleSection": { + "title": "Shopping Cart", + "text": "items in your cart" + }, + "productsSection": { + "title": "Shopping Cart", + "text": "{quantity} items in your cart", + "product": "Product", + "price": "Price", + "quantity": "Quantity", + "subtotal": "Subtotal:", + "continueShopping": { + "target": "/shop", + "anchorText": "Continue shopping" + }, + "submit": { + "title": "Checkout" + } + } + }, + "shopCheckout": { + "header": { + "title": "Shop - checkout {siteName}", + "meta": { + "description": "Single-page application checkout" + }, + "link": { + "canonical": "" + } + }, + "titleSection": { + "title": "Checkout", + "text": "Below is an example form built entirely with Bootstrap’s form controls. Each required form group has a validation state that can be triggered by attempting to submit the form without completing it." + }, + "billingAddressSection": { + "title": "Billing address", + "firstName": { + "title": "First name", + "placeHolder": "First name..." + }, + "lastName": { + "title": "Last name", + "placeHolder": "Last name..." + }, + "address": { + "title": "Address", + "placeHolder": "1234 Main Str.." + }, + "address2": { + "title": "Address", + "optional": "(Optional)", + "placeHolder": "1234 Main Str.." + }, + "country": { + "title": "Country", + "placeHolder": "Country..." + }, + "state": { + "title": "State", + "placeHolder": "State..." + }, + "city": { + "title": "City", + "placeHolder": "City..." + }, + "zip": { + "title": "Zip", + "placeHolder": "Zip..." + } + }, + "shippingAddressSection": { + "title": "Shipping address", + "firstName": { + "title": "First name", + "placeHolder": "First name..." + }, + "lastName": { + "title": "Last name", + "placeHolder": "Last name..." + }, + "address": { + "title": "Address", + "placeHolder": "1234 Main Str.." + }, + "address2": { + "title": "Address", + "optional": "(Optional)", + "placeHolder": "1234 Main Str.." + }, + "country": { + "title": "Country", + "placeHolder": "Country..." + }, + "state": { + "title": "State", + "placeHolder": "State..." + }, + "city": { + "title": "City", + "placeHolder": "City..." + }, + "zip": { + "title": "Zip", + "placeHolder": "Zip..." + } + }, + "settingsSection": { + "shippingAddressSameAsBillingAddress": "Shipping address is the same as my billing address", + "saveThisInformation": "Save this information for next time" + }, + "summarySection": { + "title": "Your cart", + "total": "Total ({currency})", + "promoCode": { + "placeHolder": "Promo code" + }, + "submit": { + "title": "Redeem" + } + }, + "paymentSection": { + "title": "Payment", + "nameOnCard": { + "title": "Name on card", + "placeHolder": "John Doe" + }, + "cardNumber": { + "title": "Credit card number", + "placeHolder": "" + }, + "expiration": { + "title": "Expiration", + "placeHolder": "MM/YY" + }, + "cvv": { + "title": "CVV", + "placeHolder": "123" + } + }, + "submit": { + "title": "Continue to checkout" + } + }, + "blogCatalog": { + "header": { + "title": "Blog catalog - {siteName}", + "meta": { + "description": "Single-page application blog catalog" + }, + "link": { + "canonical": "" + } + }, + "titleSection": { + "title": "Welcome to Blog Home!", + "text": "A Bootstrap 5 starter layout for your next blog homepage" + }, + "featuredBlogSection": { + "readTime": "{date} Time to read: {readTime} min" + } + }, + "blogItem": { + "header": { + "title": "{blogTitle} - {siteName}", + "meta": { + "description": "Single-page application blog item" + }, + "link": { + "canonical": "" + } + }, + "titleSection": { + "postedOnBy": "Posted on {date} by {nickName}" + }, + "commentsSection": { + "leaveComment": "Join the discussion and leave a comment!" + } + }, + "signIn": { + "header": { + "title": "Sign in - {siteName}", + "meta": { + "description": "Single-page application sign in", + "robots": "noindex, nofollow" + }, + "link": { + "canonical": "" + } + }, + "title": "Sign in", + "email": { + "title": "Email address", + "placeHolder": "Email address..." + }, + "password": { + "title": "Password", + "placeHolder": "Password..." + }, + "dontHaveAnAccount": "Don't have an account yet? Please", + "signUpLink": { + "target": "/signup", + "anchorText": "Sign up" + }, + "submit": { + "title": "Sign in" + } + }, + "signUp": { + "header": { + "title": "Sign up - {siteName}", + "meta": { + "description": "Single-page application sign up", + "robots": "noindex, nofollow" + }, + "link": { + "canonical": "" + } + }, + "title": "Sign up", + "username": { + "title": "Username", + "placeHolder": "Username..." + }, + "email": { + "title": "Email address", + "placeHolder": "Email address..." + }, + "reEmail": { + "title": "Repeat email address", + "placeHolder": "Repeat email address..." + }, + "password": { + "title": "Password", + "placeHolder": "Password..." + }, + "rePassword": { + "title": "Repeat password", + "placeHolder": "Repeat password..." + }, + "acceptTermsAndConditions": "Accept terms and conditions", + "submit": { + "title": "Sing up" + } + } +} \ No newline at end of file diff --git a/postman/reactredux.postman_collection.json b/postman/reactredux.postman_collection.json new file mode 100644 index 0000000..37e04a5 --- /dev/null +++ b/postman/reactredux.postman_collection.json @@ -0,0 +1,52 @@ +{ + "info": { + "_postman_id": "45e69e7b-bfb8-4555-996a-2cd5126d1aa6", + "name": "reactredux", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Content", + "item": [ + { + "name": "GetContent", + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "type": "default" + }, + { + "key": "Accept", + "value": "application/json", + "type": "default" + } + ], + "url": { + "raw": "https://localhost:7151/api/Content/b3f39a82-6a1b-46a4-85cc-04c3b4315511?locale=en-US", + "protocol": "https", + "host": [ + "localhost" + ], + "port": "7151", + "path": [ + "api", + "Content", + "b3f39a82-6a1b-46a4-85cc-04c3b4315511" + ], + "query": [ + { + "key": "locale", + "value": "en-US" + } + ] + } + }, + "response": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/webapi/Core/Abstractions/DomainObjects/PostItemBase.cs b/webapi/Core/Abstractions/DomainObjects/PostItemBase.cs index 3e8692f..8cf7b0c 100644 --- a/webapi/Core/Abstractions/DomainObjects/PostItemBase.cs +++ b/webapi/Core/Abstractions/DomainObjects/PostItemBase.cs @@ -9,6 +9,8 @@ namespace Core.Abstractions.DomainObjects { public abstract class PostItemBase : DomainObjectDocumentBase { + public List Images { get; set; } + /// /// Author / Owner /// diff --git a/webapi/Core/DomainObjects/Documents/ShopItem.cs b/webapi/Core/DomainObjects/Documents/ShopItem.cs index a28fa3d..a92ecf9 100644 --- a/webapi/Core/DomainObjects/Documents/ShopItem.cs +++ b/webapi/Core/DomainObjects/Documents/ShopItem.cs @@ -2,6 +2,7 @@ namespace Core.DomainObjects.Documents { public class ShopItem : PostItemBase { + public string Sku { get; set; } public int Rating { get; set; } public int Price { get; set; } diff --git a/webapi/Core/DomainObjects/PageSections/BlogTitleSection.cs b/webapi/Core/DomainObjects/PageSections/BlogTitleSection.cs deleted file mode 100644 index 64879c0..0000000 --- a/webapi/Core/DomainObjects/PageSections/BlogTitleSection.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Core.Abstractions.DomainObjects; - -namespace Core.DomainObjects.PageSections { - public class BlogTitleSection : PageSectionBase { - public string PostedOnBy { get; set; } - - public override int GetHashCode() { - throw new NotImplementedException(); - } - } -} diff --git a/webapi/Core/DomainObjects/PageSections/FeaturedBlogSection.cs b/webapi/Core/DomainObjects/PageSections/FeaturedBlogSection.cs index e9159e8..ac92c79 100644 --- a/webapi/Core/DomainObjects/PageSections/FeaturedBlogSection.cs +++ b/webapi/Core/DomainObjects/PageSections/FeaturedBlogSection.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; namespace Core.DomainObjects.PageSections { - public class FeaturedBlogsSection : PageSectionBase { + public class FeaturedBlogSection : PageSectionBase { public string ReadTime { get; set; } public override int GetHashCode() { diff --git a/webapi/Core/DomainObjects/PageSections/FeaturedBlogsSection.cs b/webapi/Core/DomainObjects/PageSections/FeaturedBlogsSection.cs index 2c90424..57a2a55 100644 --- a/webapi/Core/DomainObjects/PageSections/FeaturedBlogsSection.cs +++ b/webapi/Core/DomainObjects/PageSections/FeaturedBlogsSection.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; namespace Core.DomainObjects.PageSections { - public class FeaturedBologsSection : PageSectionBase { + public class FeaturedBlogsSection : PageSectionBase { public override int GetHashCode() { throw new NotImplementedException(); diff --git a/webapi/Core/DomainObjects/PageSections/ProductsSection.cs b/webapi/Core/DomainObjects/PageSections/ProductsSection.cs index e0685aa..a8fbfe7 100644 --- a/webapi/Core/DomainObjects/PageSections/ProductsSection.cs +++ b/webapi/Core/DomainObjects/PageSections/ProductsSection.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; namespace Core.DomainObjects.PageSections { - public class ProductsSection : PageSectionBase { + public class ProductsSection : PageSectionBase { public string Product { get; set; } public string Price { get; set; } diff --git a/webapi/Core/DomainObjects/PageSections/TitleSection.cs b/webapi/Core/DomainObjects/PageSections/TitleSection.cs index ec3c5df..6e4bd0d 100644 --- a/webapi/Core/DomainObjects/PageSections/TitleSection.cs +++ b/webapi/Core/DomainObjects/PageSections/TitleSection.cs @@ -3,8 +3,9 @@ namespace Core.DomainObjects.PageSections { public class TitleSection : PageSectionBase { public Image? Image { get; set; } - public MenuItem? PrimaryLink { get; set; } - public MenuItem? SecondaryLink { get; set; } + public Link? PrimaryLink { get; set; } + public Link? SecondaryLink { get; set; } + public string? PostedOnBy { get; set; } public override int GetHashCode() { throw new NotImplementedException(); diff --git a/webapi/Core/DomainObjects/Pages/BlogCatalogPage.cs b/webapi/Core/DomainObjects/Pages/BlogCatalogPage.cs index a87dde4..5641378 100644 --- a/webapi/Core/DomainObjects/Pages/BlogCatalogPage.cs +++ b/webapi/Core/DomainObjects/Pages/BlogCatalogPage.cs @@ -7,7 +7,7 @@ namespace Core.DomainObjects.Pages { public Header Header { get; set; } public TitleSection TitleSection { get; set; } - public FeaturedBlogsSection FeaturedBlogSection { get; set; } + public FeaturedBlogSection FeaturedBlogSection { get; set; } public override int GetHashCode() { throw new NotImplementedException(); diff --git a/webapi/Core/DomainObjects/Pages/BlogItemPage.cs b/webapi/Core/DomainObjects/Pages/BlogItemPage.cs index c57f501..2f1c11a 100644 --- a/webapi/Core/DomainObjects/Pages/BlogItemPage.cs +++ b/webapi/Core/DomainObjects/Pages/BlogItemPage.cs @@ -5,7 +5,7 @@ namespace Core.DomainObjects.Pages { public class BlogItemPage : PageBase { public Header Header { get; set; } - public BlogTitleSection TitleSection { get; set; } + public TitleSection TitleSection { get; set; } public CommentsSection CommentsSection { get; set; } public override int GetHashCode() { diff --git a/webapi/Core/DomainObjects/Pages/HomePage.cs b/webapi/Core/DomainObjects/Pages/HomePage.cs index 18af212..d89ca8b 100644 --- a/webapi/Core/DomainObjects/Pages/HomePage.cs +++ b/webapi/Core/DomainObjects/Pages/HomePage.cs @@ -8,7 +8,7 @@ namespace Core.DomainObjects.Pages { public TitleSection TitleSection { get; set; } public FeaturesSection FeaturesSection { get; set; } public TestimonialsSection TestimonialsSection { get; set; } - public FeaturedBologsSection FeaturedBlogsSection { get; set; } + public FeaturedBlogsSection FeaturedBlogsSection { get; set; } public CallToActionSection CallToActionSection { get; set; } public override int GetHashCode() { diff --git a/webapi/DataProviders/Mappings.cs b/webapi/DataProviders/Mappings.cs index 4266e25..912b5ba 100644 --- a/webapi/DataProviders/Mappings.cs +++ b/webapi/DataProviders/Mappings.cs @@ -123,12 +123,6 @@ namespace DataProviders { }); } - if (!BsonClassMap.IsClassMapRegistered(typeof(BlogTitleSection))) { - BsonClassMap.RegisterClassMap(cm => { - cm.AutoMap(); - }); - } - if (!BsonClassMap.IsClassMapRegistered(typeof(CallToActionSection))) { BsonClassMap.RegisterClassMap(cm => { cm.AutoMap(); @@ -141,14 +135,14 @@ namespace DataProviders { }); } - if (!BsonClassMap.IsClassMapRegistered(typeof(FeaturedBlogsSection))) { - BsonClassMap.RegisterClassMap(cm => { + if (!BsonClassMap.IsClassMapRegistered(typeof(FeaturedBlogSection))) { + BsonClassMap.RegisterClassMap(cm => { cm.AutoMap(); }); } - if (!BsonClassMap.IsClassMapRegistered(typeof(FeaturedBlogsSection))) { - BsonClassMap.RegisterClassMap(cm => { + if (!BsonClassMap.IsClassMapRegistered(typeof(FeaturedBlogSection))) { + BsonClassMap.RegisterClassMap(cm => { cm.AutoMap(); }); } diff --git a/webapi/WeatherForecast/Controllers/BlogCatalogController.cs b/webapi/WeatherForecast/Controllers/BlogCatalogController.cs index b9fed77..681db4d 100644 --- a/webapi/WeatherForecast/Controllers/BlogCatalogController.cs +++ b/webapi/WeatherForecast/Controllers/BlogCatalogController.cs @@ -43,7 +43,6 @@ public class BlogCatalogController : ControllerBase { ShortText = "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...", Text = "", Author = new AuthorModel { - Id = Guid.NewGuid(), Image = new ImageModel { Src = "https://dummyimage.com/40x40/ced4da/6c757d", Alt = "..." }, NickName = "Admin" }, diff --git a/webapi/WeatherForecast/Controllers/BlogFeaturedController.cs b/webapi/WeatherForecast/Controllers/BlogFeaturedController.cs index c0d0211..efa391f 100644 --- a/webapi/WeatherForecast/Controllers/BlogFeaturedController.cs +++ b/webapi/WeatherForecast/Controllers/BlogFeaturedController.cs @@ -34,7 +34,7 @@ namespace WeatherForecast.Controllers { ShortText = "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...", Text = "", Author = new AuthorModel { - Id = Guid.NewGuid(), + //Id = Guid.NewGuid(), Image = new ImageModel { Src = "https://dummyimage.com/40x40/ced4da/6c757d", Alt = "..." }, NickName = "Admin" }, diff --git a/webapi/WeatherForecast/Controllers/ShopCatalogController.cs b/webapi/WeatherForecast/Controllers/ShopCatalogController.cs index bfdf28c..b6b31a1 100644 --- a/webapi/WeatherForecast/Controllers/ShopCatalogController.cs +++ b/webapi/WeatherForecast/Controllers/ShopCatalogController.cs @@ -42,7 +42,7 @@ public class ShopCatalogController : ControllerBase { ShortText = "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque fugit ratione dicta mollitia. Officiis ad...", Text = "", Author = new AuthorModel { - Id = Guid.NewGuid(), + // Id = Guid.NewGuid(), Image = new ImageModel { Src = "https://dummyimage.com/40x40/ced4da/6c757d", Alt = "..." }, NickName = "Admin" }, diff --git a/webapi/WeatherForecast/Models/Abstractions/AddressPageSectionModel.cs b/webapi/WeatherForecast/Models/Abstractions/AddressPageSectionModel.cs deleted file mode 100644 index 8126a3e..0000000 --- a/webapi/WeatherForecast/Models/Abstractions/AddressPageSectionModel.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace WeatherForecast.Models.Abstractions { - public abstract class AddressPageSectionModel : PageSectionModel { - public FormItemModel FirstName { get; set; } - - public FormItemModel LastName { get; set; } - - public FormItemModel Address { get; set; } - - public FormItemModel Address2 { get; set; } - - public FormItemModel Country { get; set; } - - public FormItemModel State { get; set; } - - public FormItemModel City { get; set; } - - public FormItemModel Zip { get; set; } - } - -} diff --git a/webapi/WeatherForecast/Models/Abstractions/AddressSectionModelBase.cs b/webapi/WeatherForecast/Models/Abstractions/AddressSectionModelBase.cs new file mode 100644 index 0000000..d1c2c83 --- /dev/null +++ b/webapi/WeatherForecast/Models/Abstractions/AddressSectionModelBase.cs @@ -0,0 +1,33 @@ +using Core.Abstractions.DomainObjects; + +namespace WeatherForecast.Models.Abstractions { + public abstract class AddressSectionModelBase : PageSectionModelBase { + + public FormItemModel FirstName { get; set; } + + public FormItemModel LastName { get; set; } + + public FormItemModel Address { get; set; } + + public FormItemModel Address2 { get; set; } + + public FormItemModel Country { get; set; } + + public FormItemModel State { get; set; } + + public FormItemModel City { get; set; } + + public FormItemModel Zip { get; set; } + + public AddressSectionModelBase(AddressSectionBase addressSection) : base(addressSection) { + FirstName = new FormItemModel(addressSection.FirstName); + LastName = new FormItemModel(addressSection.LastName); + Address = new FormItemModel(addressSection.Address); + Address2 = new FormItemModel(addressSection.Address2); + Country = new FormItemModel(addressSection.FirstName); + State = new FormItemModel(addressSection.State); + City = new FormItemModel(addressSection.City); + Zip = new FormItemModel(addressSection.Zip); + } + } +} diff --git a/webapi/WeatherForecast/Models/Abstractions/PageModel.cs b/webapi/WeatherForecast/Models/Abstractions/PageModel.cs deleted file mode 100644 index 8046b19..0000000 --- a/webapi/WeatherForecast/Models/Abstractions/PageModel.cs +++ /dev/null @@ -1,4 +0,0 @@ - -namespace WeatherForecast.Models.Abstractions { - public abstract class PageModel { } -} diff --git a/webapi/WeatherForecast/Models/Abstractions/PageModelBase.cs b/webapi/WeatherForecast/Models/Abstractions/PageModelBase.cs new file mode 100644 index 0000000..2a12422 --- /dev/null +++ b/webapi/WeatherForecast/Models/Abstractions/PageModelBase.cs @@ -0,0 +1,21 @@ + +using Core.Abstractions.Models; +using Core.DomainObjects; +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.PageSections; + +namespace WeatherForecast.Models.Abstractions { + public abstract class PageModelBase : ModelBase { + + public HeaderModel Header { get; set; } + + public TitleSectionModel? TitleSection { get; set; } + + public PageModelBase() { } + + public PageModelBase(Header header, TitleSection titleSection) { + TitleSection = new TitleSectionModel(titleSection); + Header = new HeaderModel(header); + } + } +} diff --git a/webapi/WeatherForecast/Models/Abstractions/PageSectionModel.cs b/webapi/WeatherForecast/Models/Abstractions/PageSectionModel.cs deleted file mode 100644 index e07500f..0000000 --- a/webapi/WeatherForecast/Models/Abstractions/PageSectionModel.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace WeatherForecast.Models.Abstractions { - public abstract class PageSectionModel { - public string? Title { get; set; } - public string? Text { get; set; } - } -} diff --git a/webapi/WeatherForecast/Models/Abstractions/PageSectionModelBase.cs b/webapi/WeatherForecast/Models/Abstractions/PageSectionModelBase.cs new file mode 100644 index 0000000..2e123f2 --- /dev/null +++ b/webapi/WeatherForecast/Models/Abstractions/PageSectionModelBase.cs @@ -0,0 +1,21 @@ +using Core.Abstractions.DomainObjects; +using Core.Abstractions.Models; + +namespace WeatherForecast.Models.Abstractions { + public abstract class PageSectionModelBase : ModelBase { + public string? Title { get; set; } + public string? Text { get; set; } + + public PageSectionModelBase() { } + + public PageSectionModelBase(PageSectionBase pageSectionBase) { + Title = pageSectionBase.Title; + Text = pageSectionBase.Text; + } + + public PageSectionModelBase(string? title, string? text) { + Title = title; + Text = text; + } + } +} diff --git a/webapi/WeatherForecast/Models/Abstractions/PersonModel.cs b/webapi/WeatherForecast/Models/Abstractions/PersonModel.cs deleted file mode 100644 index b85f83b..0000000 --- a/webapi/WeatherForecast/Models/Abstractions/PersonModel.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace WeatherForecast.Models.Abstractions { - public abstract class PersonModel { - public Guid Id { get; set; } - public ImageModel? Image { get; set; } - } -} diff --git a/webapi/WeatherForecast/Models/Abstractions/PersonModelBase.cs b/webapi/WeatherForecast/Models/Abstractions/PersonModelBase.cs new file mode 100644 index 0000000..6b687b4 --- /dev/null +++ b/webapi/WeatherForecast/Models/Abstractions/PersonModelBase.cs @@ -0,0 +1,14 @@ +using Core.Abstractions.Models; +using Core.DomainObjects; + +namespace WeatherForecast.Models.Abstractions { + public abstract class PersonModelBase : ModelBase { + public ImageModel? Image { get; set; } + + public PersonModelBase() { } + + public PersonModelBase(Image? image) { + Image = new ImageModel(image); + } + } +} diff --git a/webapi/WeatherForecast/Models/Abstractions/PostItemModel.cs b/webapi/WeatherForecast/Models/Abstractions/PostItemModelBase.cs similarity index 74% rename from webapi/WeatherForecast/Models/Abstractions/PostItemModel.cs rename to webapi/WeatherForecast/Models/Abstractions/PostItemModelBase.cs index 87931f6..b6ff872 100644 --- a/webapi/WeatherForecast/Models/Abstractions/PostItemModel.cs +++ b/webapi/WeatherForecast/Models/Abstractions/PostItemModelBase.cs @@ -1,5 +1,7 @@ -namespace WeatherForecast.Models.Abstractions { - public abstract class PostItemModel { +using Core.Abstractions.Models; + +namespace WeatherForecast.Models.Abstractions { + public abstract class PostItemModelBase : ModelBase { public Guid Id { get; set; } public string Slug { get; set; } diff --git a/webapi/WeatherForecast/Models/AuthorModel.cs b/webapi/WeatherForecast/Models/AuthorModel.cs index d5d049e..4146a68 100644 --- a/webapi/WeatherForecast/Models/AuthorModel.cs +++ b/webapi/WeatherForecast/Models/AuthorModel.cs @@ -1,7 +1,7 @@ using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models { - public class AuthorModel : PersonModel { + public class AuthorModel : PersonModelBase { public string NickName { get; set; } } } diff --git a/webapi/WeatherForecast/Models/BlogItemModel.cs b/webapi/WeatherForecast/Models/BlogItemModel.cs index 8551e71..79945e5 100644 --- a/webapi/WeatherForecast/Models/BlogItemModel.cs +++ b/webapi/WeatherForecast/Models/BlogItemModel.cs @@ -1,7 +1,7 @@ using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models { - public class BlogItemModel : PostItemModel { + public class BlogItemModel : PostItemModelBase { public int? ReadTime { get; set; } diff --git a/webapi/WeatherForecast/Models/FeatureModel.cs b/webapi/WeatherForecast/Models/FeatureModel.cs index 659e62e..3c02ac6 100644 --- a/webapi/WeatherForecast/Models/FeatureModel.cs +++ b/webapi/WeatherForecast/Models/FeatureModel.cs @@ -1,7 +1,15 @@ -namespace WeatherForecast.Models { +using Core.DomainObjects; + +namespace WeatherForecast.Models { public class FeatureModel { public string Icon { get; set; } public string Title { get; set; } public string Text { get; set; } + + public FeatureModel(Feature feature) { + Icon = feature.Icon; + Title = feature.Title; + Text = feature.Text; + } } -} +} \ No newline at end of file diff --git a/webapi/WeatherForecast/Models/FormItemModel.cs b/webapi/WeatherForecast/Models/FormItemModel.cs index cdc3d43..38068a4 100644 --- a/webapi/WeatherForecast/Models/FormItemModel.cs +++ b/webapi/WeatherForecast/Models/FormItemModel.cs @@ -1,6 +1,13 @@ -namespace WeatherForecast.Models { +using Core.DomainObjects; + +namespace WeatherForecast.Models { public class FormItemModel { public string? Title { get; set; } public string? PlaceHolder { get; set; } + + public FormItemModel(FormItem formItem) { + Title = formItem.Title; + PlaceHolder = formItem.PlaceHolder; + } } } diff --git a/webapi/WeatherForecast/Models/HeaderModel.cs b/webapi/WeatherForecast/Models/HeaderModel.cs index ab8c29f..631162a 100644 --- a/webapi/WeatherForecast/Models/HeaderModel.cs +++ b/webapi/WeatherForecast/Models/HeaderModel.cs @@ -1,4 +1,6 @@ -namespace WeatherForecast.Models { +using Core.DomainObjects; + +namespace WeatherForecast.Models { public class HeaderModel { @@ -6,6 +8,12 @@ public Dictionary? Link { get; set; } public Dictionary? Meta { get; set; } + + public HeaderModel(Header header) { + Title = header.Title; + Link = header.Link; + Meta = header.Meta; + } } diff --git a/webapi/WeatherForecast/Models/ImageModel.cs b/webapi/WeatherForecast/Models/ImageModel.cs index 1c6c6b4..f9d9cb2 100644 --- a/webapi/WeatherForecast/Models/ImageModel.cs +++ b/webapi/WeatherForecast/Models/ImageModel.cs @@ -1,6 +1,15 @@ -namespace WeatherForecast.Models { +using Core.DomainObjects; + +namespace WeatherForecast.Models { public class ImageModel { public string Src { get; set; } public string Alt { get; set; } + + public ImageModel() { } + + public ImageModel(Image image) { + Src = image.Src; + Alt = image.Alt; + } } } diff --git a/webapi/WeatherForecast/Models/LinkModel.cs b/webapi/WeatherForecast/Models/LinkModel.cs index 4326d51..b57adbb 100644 --- a/webapi/WeatherForecast/Models/LinkModel.cs +++ b/webapi/WeatherForecast/Models/LinkModel.cs @@ -1,6 +1,13 @@ -namespace WeatherForecast.Models { +using Core.DomainObjects; + +namespace WeatherForecast.Models { public class LinkModel { - public string Target { get; set; } - public string AnchorText { get; set; } + public string? Target { get; set; } + public string? AnchorText { get; set; } + + public LinkModel(Link link) { + Target = link.Target; + AnchorText = link.AnchorText; + } } } diff --git a/webapi/WeatherForecast/Models/LocalizationModel.cs b/webapi/WeatherForecast/Models/LocalizationModel.cs index 6addd72..5262497 100644 --- a/webapi/WeatherForecast/Models/LocalizationModel.cs +++ b/webapi/WeatherForecast/Models/LocalizationModel.cs @@ -1,4 +1,6 @@ -namespace WeatherForecast.Models { +using Core.DomainObjects; + +namespace WeatherForecast.Models { public class LocalizationModel { public string? TimeZone { get; set; } @@ -11,5 +13,14 @@ public string? Currency { get; set; } public string? CurrencySymbol { get; set; } + + public LocalizationModel(Localization localization) { + TimeZone = localization.TimeZone; + Locale = localization.Locale; + DateFormat = localization.DateFormat; + TimeFormat = localization.TimeFormat; + Currency = localization.Currency; + CurrencySymbol = localization.CurrencySymbol; + } } } diff --git a/webapi/WeatherForecast/Models/MenuItemModel.cs b/webapi/WeatherForecast/Models/MenuItemModel.cs index 8a0e1bc..f728863 100644 --- a/webapi/WeatherForecast/Models/MenuItemModel.cs +++ b/webapi/WeatherForecast/Models/MenuItemModel.cs @@ -1,11 +1,16 @@ -namespace WeatherForecast.Models { +using Core.DomainObjects; + +namespace WeatherForecast.Models { public class MenuItemModel { public string? Icon { get; set; } public string? Title { get; set; } public string? Target { get; set; } public List? ChildItems { get; set; } - - + public MenuItemModel(MenuItem menuItem) { + Title = menuItem.Title; + Target = menuItem.Target; + ChildItems = menuItem.ChildItems?.Select(x => new MenuItemModel(x)).ToList(); + } } } diff --git a/webapi/WeatherForecast/Models/PageSections/BillingAddressSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/BillingAddressSectionModel.cs new file mode 100644 index 0000000..58cb15c --- /dev/null +++ b/webapi/WeatherForecast/Models/PageSections/BillingAddressSectionModel.cs @@ -0,0 +1,9 @@ +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; + +namespace WeatherForecast.Models.PageSections { + public class BillingAddressSectionModel : AddressSectionModelBase { + + public BillingAddressSectionModel(BillingAddressSection billingAddressSection) : base(billingAddressSection) { } + } +} diff --git a/webapi/WeatherForecast/Models/PageSections/BlogTitleSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/BlogTitleSectionModel.cs deleted file mode 100644 index 3c254bc..0000000 --- a/webapi/WeatherForecast/Models/PageSections/BlogTitleSectionModel.cs +++ /dev/null @@ -1,7 +0,0 @@ -using WeatherForecast.Models.Abstractions; - -namespace WeatherForecast.Models.PageSections { - public class BlogTitleSectionModel : PageSectionModel { - public string PostedOnBy { get; set; } - } -} diff --git a/webapi/WeatherForecast/Models/PageSections/CallToActionSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/CallToActionSectionModel.cs index f71e68b..d6a8df4 100644 --- a/webapi/WeatherForecast/Models/PageSections/CallToActionSectionModel.cs +++ b/webapi/WeatherForecast/Models/PageSections/CallToActionSectionModel.cs @@ -1,9 +1,15 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models.PageSections { - public class CallToActionSectionModel : PageSectionModel { + public class CallToActionSectionModel : PageSectionModelBase { public string PrivacyDisclaimer { get; set; } public FormItemModel Email { get; set; } + + public CallToActionSectionModel(CallToActionSection callToActionSection) : base(callToActionSection) { + PrivacyDisclaimer = callToActionSection.PrivacyDisclaimer; + Email = new FormItemModel(callToActionSection.Email); + } } } diff --git a/webapi/WeatherForecast/Models/PageSections/CommentsSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/CommentsSectionModel.cs index bcb4905..7a416ba 100644 --- a/webapi/WeatherForecast/Models/PageSections/CommentsSectionModel.cs +++ b/webapi/WeatherForecast/Models/PageSections/CommentsSectionModel.cs @@ -1,7 +1,13 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models.PageSections { - public class CommentsSectionModel : PageSectionModel { + public class CommentsSectionModel : PageSectionModelBase { public string LeaveComment { get; set; } + + public CommentsSectionModel(CommentsSection commentsSection) : base (commentsSection) { + + LeaveComment = commentsSection.LeaveComment; + } } } diff --git a/webapi/WeatherForecast/Models/PageSections/FeaturedBlogSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/FeaturedBlogSectionModel.cs index d81aadb..436e1b4 100644 --- a/webapi/WeatherForecast/Models/PageSections/FeaturedBlogSectionModel.cs +++ b/webapi/WeatherForecast/Models/PageSections/FeaturedBlogSectionModel.cs @@ -1,7 +1,14 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models.PageSections { - public class FeaturedBlogSectionModel : PageSectionModel { + public class FeaturedBlogSectionModel : PageSectionModelBase { public string ReadTime { get; set; } + + public FeaturedBlogSectionModel() : base() { } + + public FeaturedBlogSectionModel(FeaturedBlogSection featuredBlogSection) : base(featuredBlogSection) { + ReadTime = featuredBlogSection.ReadTime; + } } } diff --git a/webapi/WeatherForecast/Models/PageSections/FeaturedBologsSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/FeaturedBologsSectionModel.cs index 0c813c8..847c6ec 100644 --- a/webapi/WeatherForecast/Models/PageSections/FeaturedBologsSectionModel.cs +++ b/webapi/WeatherForecast/Models/PageSections/FeaturedBologsSectionModel.cs @@ -1,5 +1,9 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models.PageSections { - public class FeaturedBologsSectionModel : PageSectionModel { } + public class FeaturedBlogsSectionModel : PageSectionModelBase { + + public FeaturedBlogsSectionModel(FeaturedBlogsSection featuredBlogsSection) : base(featuredBlogsSection) { } + } } diff --git a/webapi/WeatherForecast/Models/PageSections/FeaturesSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/FeaturesSectionModel.cs index bc18649..5b9895c 100644 --- a/webapi/WeatherForecast/Models/PageSections/FeaturesSectionModel.cs +++ b/webapi/WeatherForecast/Models/PageSections/FeaturesSectionModel.cs @@ -1,7 +1,12 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models.PageSections { - public class FeaturesSectionModel : PageSectionModel { + public class FeaturesSectionModel : PageSectionModelBase { public List Items { get; set; } + + public FeaturesSectionModel(FeaturesSection featuresSection) : base(featuresSection) { + Items = featuresSection.Items.Select(x => new FeatureModel(x)).ToList(); + } } } diff --git a/webapi/WeatherForecast/Models/PageSections/PaymentSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/PaymentSectionModel.cs new file mode 100644 index 0000000..df21c75 --- /dev/null +++ b/webapi/WeatherForecast/Models/PageSections/PaymentSectionModel.cs @@ -0,0 +1,20 @@ +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; + +namespace WeatherForecast.Models.PageSections { + public class PaymentSectionModel : PageSectionModelBase { + + public FormItemModel NameOnCard { get; set; } + public FormItemModel CardNumber { get; set; } + public FormItemModel Expiration { get; set; } + public FormItemModel Cvv { get; set; } + + public PaymentSectionModel(PaymentSection paymentSection) : base(paymentSection) { + NameOnCard = new FormItemModel(paymentSection.NameOnCard); + CardNumber = new FormItemModel(paymentSection.CardNumber); + Expiration = new FormItemModel(paymentSection.Expiration); + Cvv = new FormItemModel(paymentSection.Cvv); + } + + } +} diff --git a/webapi/WeatherForecast/Models/PageSections/ProductSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/ProductSectionModel.cs index 5cbaad4..d4c5284 100644 --- a/webapi/WeatherForecast/Models/PageSections/ProductSectionModel.cs +++ b/webapi/WeatherForecast/Models/PageSections/ProductSectionModel.cs @@ -1,8 +1,14 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models.PageSections { - public class ProductSectionModel : PageSectionModel { + public class ProductSectionModel : PageSectionModelBase { public string AvailableQuantity { get; set; } public string AddToCart { get; set; } + + public ProductSectionModel(ProductSection productSection) : base(productSection) { + AvailableQuantity = productSection.AvailableQuantity; + AddToCart = productSection.AddToCart; + } } } diff --git a/webapi/WeatherForecast/Models/PageSections/ProductsSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/ProductsSectionModel.cs new file mode 100644 index 0000000..2ce4e01 --- /dev/null +++ b/webapi/WeatherForecast/Models/PageSections/ProductsSectionModel.cs @@ -0,0 +1,25 @@ + + +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; + +namespace WeatherForecast.Models.PageSections { + public class ProductsSectionModel : PageSectionModelBase { + + public string Product { get; set; } + public string Price { get; set; } + public string Quantity { get; set; } + public string Subtotal { get; set; } + public LinkModel ContinueShopping { get; set; } + public FormItemModel Submit { get; set; } + + public ProductsSectionModel(ProductsSection productsSection) : base(productsSection) { + Product = productsSection.Product; + Price = productsSection.Price; + Quantity = productsSection.Quantity; + Subtotal = productsSection.Subtotal; + ContinueShopping = new LinkModel(productsSection.ContinueShopping); + Submit = new FormItemModel(productsSection.Submit); + } + } +} diff --git a/webapi/WeatherForecast/Models/PageSections/RelatedProductsSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/RelatedProductsSectionModel.cs index dcf6977..0474068 100644 --- a/webapi/WeatherForecast/Models/PageSections/RelatedProductsSectionModel.cs +++ b/webapi/WeatherForecast/Models/PageSections/RelatedProductsSectionModel.cs @@ -1,7 +1,13 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models.PageSections { - public class RelatedProductsSectionModel : PageSectionModel { + public class RelatedProductsSectionModel : PageSectionModelBase { + public string AddToCart { get; set; } + + public RelatedProductsSectionModel(RelatedProductsSection relatedProductsSection) : base(relatedProductsSection) { + AddToCart = relatedProductsSection.AddToCart; + } } } diff --git a/webapi/WeatherForecast/Models/PageSections/SettingsSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/SettingsSectionModel.cs new file mode 100644 index 0000000..2edbd21 --- /dev/null +++ b/webapi/WeatherForecast/Models/PageSections/SettingsSectionModel.cs @@ -0,0 +1,15 @@ +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; + +namespace WeatherForecast.Models.PageSections { + public class SettingsSectionModel : PageSectionModelBase { + + public string ShippingAddressSameAsBillingAddress { get; set; } + public string SaveThisInformation { get; set; } + + public SettingsSectionModel(SettingsSection settingsSection) : base(settingsSection) { + ShippingAddressSameAsBillingAddress = settingsSection.ShippingAddressSameAsBillingAddress; + SaveThisInformation = settingsSection.SaveThisInformation; + } + } +} diff --git a/webapi/WeatherForecast/Models/PageSections/ShippingAddressSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/ShippingAddressSectionModel.cs new file mode 100644 index 0000000..692614f --- /dev/null +++ b/webapi/WeatherForecast/Models/PageSections/ShippingAddressSectionModel.cs @@ -0,0 +1,9 @@ +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; + +namespace WeatherForecast.Models.PageSections { + + public class ShippingAddressSectionModel : AddressSectionModelBase { + public ShippingAddressSectionModel(ShippingAddressSection shippingAddressSection) : base(shippingAddressSection) { } + } +} diff --git a/webapi/WeatherForecast/Models/PageSections/SummarySectionModel.cs b/webapi/WeatherForecast/Models/PageSections/SummarySectionModel.cs new file mode 100644 index 0000000..29cfeb3 --- /dev/null +++ b/webapi/WeatherForecast/Models/PageSections/SummarySectionModel.cs @@ -0,0 +1,20 @@ +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; + +namespace WeatherForecast.Models.PageSections { + public class SummarySectionModel : PageSectionModelBase { + + public string Total { get; set; } + + public FormItemModel PromoCode { get; set; } + + public FormItemModel Submit { get; set; } + + public SummarySectionModel(SummarySection summarySection) : base(summarySection) { + Total = summarySection.Total; + PromoCode = new FormItemModel(summarySection.PromoCode); + Submit = new FormItemModel(summarySection.Submit); + } + + } +} diff --git a/webapi/WeatherForecast/Models/PageSections/TestimonialsSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/TestimonialsSectionModel.cs index c7efd7a..8d181f3 100644 --- a/webapi/WeatherForecast/Models/PageSections/TestimonialsSectionModel.cs +++ b/webapi/WeatherForecast/Models/PageSections/TestimonialsSectionModel.cs @@ -1,7 +1,13 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models.PageSections { - public class TestimonialsSectionModel : PageSectionModel { + public class TestimonialsSectionModel : PageSectionModelBase { public List Items { get; set; } + + + public TestimonialsSectionModel(TestimonialsSection testimonialsSection) : base(testimonialsSection) { + Items = testimonialsSection.Items.Select(x => new TestimonialModel(x)).ToList(); + } } } diff --git a/webapi/WeatherForecast/Models/PageSections/TitleSectionModel.cs b/webapi/WeatherForecast/Models/PageSections/TitleSectionModel.cs index 91ef73b..bf64368 100644 --- a/webapi/WeatherForecast/Models/PageSections/TitleSectionModel.cs +++ b/webapi/WeatherForecast/Models/PageSections/TitleSectionModel.cs @@ -1,10 +1,30 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.PageSections; +using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models.PageSections { - public class TitleSectionModel : PageSectionModel { + public class TitleSectionModel : PageSectionModelBase { public ImageModel? Image { get; set; } - public MenuItemModel? PrimaryLink { get; set; } - public MenuItemModel? SecondaryLink { get; set; } + public LinkModel? PrimaryLink { get; set; } + public LinkModel? SecondaryLink { get; set; } + + public string? PostedOnBy { get; set; } + + public TitleSectionModel() { } + + public TitleSectionModel(TitleSection titleSection) : base(titleSection) { + + if(titleSection.Image != null) + Image = new ImageModel(titleSection.Image); + + if (titleSection.PrimaryLink != null) + PrimaryLink = new LinkModel(titleSection.PrimaryLink); + + if (titleSection.SecondaryLink != null) + PrimaryLink = new LinkModel(titleSection.SecondaryLink); + + if (titleSection.PostedOnBy != null) + PostedOnBy = titleSection.PostedOnBy; + } } } diff --git a/webapi/WeatherForecast/Models/Pages/BlogCatalogPageModel.cs b/webapi/WeatherForecast/Models/Pages/BlogCatalogPageModel.cs index 488e070..7309346 100644 --- a/webapi/WeatherForecast/Models/Pages/BlogCatalogPageModel.cs +++ b/webapi/WeatherForecast/Models/Pages/BlogCatalogPageModel.cs @@ -1,9 +1,14 @@ -using Microsoft.AspNetCore.Mvc.RazorPages; +using Core.DomainObjects.Pages; +using WeatherForecast.Models.Abstractions; using WeatherForecast.Models.PageSections; namespace WeatherForecast.Models.Pages { - public class BlogCatalogPageModel : PageModel { - public TitleSectionModel TitleSection { get; set; } + public class BlogCatalogPageModel : PageModelBase { + public FeaturedBlogSectionModel FeaturedBlogSection { get; set; } + + public BlogCatalogPageModel(BlogCatalogPage blogCatalogPage) : base(blogCatalogPage.Header, blogCatalogPage.TitleSection) { + FeaturedBlogSection = new FeaturedBlogSectionModel(blogCatalogPage.FeaturedBlogSection); + } } } diff --git a/webapi/WeatherForecast/Models/Pages/BlogItemPageModel.cs b/webapi/WeatherForecast/Models/Pages/BlogItemPageModel.cs index 9259d00..1100a6d 100644 --- a/webapi/WeatherForecast/Models/Pages/BlogItemPageModel.cs +++ b/webapi/WeatherForecast/Models/Pages/BlogItemPageModel.cs @@ -1,9 +1,13 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.Pages; +using WeatherForecast.Models.Abstractions; using WeatherForecast.Models.PageSections; namespace WeatherForecast.Models.Pages { - public class BlogItemPageModel : PageModel { - public BlogTitleSectionModel TitleSection { get; set; } - public CommentsSectionModel CommentsSection { get; set; } + public class BlogItemPageModel : PageModelBase { + public CommentsSectionModel CommentsSection { get; set; } + + public BlogItemPageModel(BlogItemPage blogItemPage) : base(blogItemPage.Header, blogItemPage.TitleSection) { + CommentsSection = new CommentsSectionModel(blogItemPage.CommentsSection); + } } } diff --git a/webapi/WeatherForecast/Models/Pages/HomePageModel.cs b/webapi/WeatherForecast/Models/Pages/HomePageModel.cs index 5904305..de3caa2 100644 --- a/webapi/WeatherForecast/Models/Pages/HomePageModel.cs +++ b/webapi/WeatherForecast/Models/Pages/HomePageModel.cs @@ -1,13 +1,21 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.Pages; +using WeatherForecast.Models.Abstractions; using WeatherForecast.Models.PageSections; namespace WeatherForecast.Models.Pages { - public class HomePageModel : PageModel{ + public class HomePageModel : PageModelBase{ public TitleSectionModel TitleSection { get; set; } public FeaturesSectionModel FeaturesSection { get; set; } public TestimonialsSectionModel TestimonialsSection { get; set; } - public FeaturedBologsSectionModel FeaturedBlogsSection { get; set; } + public FeaturedBlogsSectionModel FeaturedBlogsSection { get; set; } public CallToActionSectionModel CallToActionSection { get; set; } + public HomePageModel(HomePage homePage) { + TitleSection = new TitleSectionModel(homePage.TitleSection); + FeaturesSection = new FeaturesSectionModel(homePage.FeaturesSection); + TestimonialsSection = new TestimonialsSectionModel(homePage.TestimonialsSection); + FeaturedBlogsSection = new FeaturedBlogsSectionModel(homePage.FeaturedBlogsSection); + CallToActionSection = new CallToActionSectionModel(homePage.CallToActionSection); + } } } diff --git a/webapi/WeatherForecast/Models/Pages/ShopCartPageModel.cs b/webapi/WeatherForecast/Models/Pages/ShopCartPageModel.cs new file mode 100644 index 0000000..4be2f5e --- /dev/null +++ b/webapi/WeatherForecast/Models/Pages/ShopCartPageModel.cs @@ -0,0 +1,16 @@ + +using Core.DomainObjects.Pages; +using WeatherForecast.Models.Abstractions; +using WeatherForecast.Models.PageSections; + +namespace WeatherForecast.Models.Pages { + public class ShopCartPageModel : PageModelBase { + + public ProductsSectionModel ProductsSectionModel { get; set; } + + public ShopCartPageModel(ShopCartPage shopCartPage) : base(shopCartPage.Header, shopCartPage.TitleSection) { + + ProductsSectionModel = new ProductsSectionModel(shopCartPage.ProductsSection); + } + } +} diff --git a/webapi/WeatherForecast/Models/Pages/ShopCatalogPageModel.cs b/webapi/WeatherForecast/Models/Pages/ShopCatalogPageModel.cs index 19ddf7d..b887bb7 100644 --- a/webapi/WeatherForecast/Models/Pages/ShopCatalogPageModel.cs +++ b/webapi/WeatherForecast/Models/Pages/ShopCatalogPageModel.cs @@ -1,8 +1,9 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.Pages; +using WeatherForecast.Models.Abstractions; using WeatherForecast.Models.PageSections; namespace WeatherForecast.Models.Pages { - public class ShopCatalogPageModel : PageModel { - public TitleSectionModel TitleSection { get; set; } + public class ShopCatalogPageModel : PageModelBase { + public ShopCatalogPageModel(ShopCatalogPage shopCatalogPage) : base(shopCatalogPage.Header, shopCatalogPage.TitleSection) { } } } diff --git a/webapi/WeatherForecast/Models/Pages/ShopCheckoutPageModel.cs b/webapi/WeatherForecast/Models/Pages/ShopCheckoutPageModel.cs new file mode 100644 index 0000000..da18514 --- /dev/null +++ b/webapi/WeatherForecast/Models/Pages/ShopCheckoutPageModel.cs @@ -0,0 +1,27 @@ +using Core.DomainObjects.Pages; +using WeatherForecast.Models.Abstractions; +using WeatherForecast.Models.PageSections; + +namespace WeatherForecast.Models.Pages { + public class ShopCheckoutPageModel : PageModelBase { + + public BillingAddressSectionModel BillingAddressSection { get; set; } + public ShippingAddressSectionModel ShippingAddressSection { get; set; } + public SettingsSectionModel SettingsSection { get; set; } + public SummarySectionModel SummarySection { get; set; } + public PaymentSectionModel PaymentSection { get; set; } + public FormItemModel Submit { get; set; } + + public ShopCheckoutPageModel(ShopCheckoutPage shopCheckoutPage) : base(shopCheckoutPage.Header, shopCheckoutPage.TitleSection) { + + BillingAddressSection = new BillingAddressSectionModel(shopCheckoutPage.BillingAddressSection); + ShippingAddressSection = new ShippingAddressSectionModel(shopCheckoutPage.ShippingAddressSection); + SettingsSection = new SettingsSectionModel(shopCheckoutPage.SettingsSection); + SummarySection = new SummarySectionModel(shopCheckoutPage.SummarySection); + PaymentSection = new PaymentSectionModel(shopCheckoutPage.PaymentSection); + + Submit = new FormItemModel(shopCheckoutPage.Submit); + + } + } +} diff --git a/webapi/WeatherForecast/Models/Pages/ShopItemPageModel.cs b/webapi/WeatherForecast/Models/Pages/ShopItemPageModel.cs index 453a7c9..9230ce5 100644 --- a/webapi/WeatherForecast/Models/Pages/ShopItemPageModel.cs +++ b/webapi/WeatherForecast/Models/Pages/ShopItemPageModel.cs @@ -1,9 +1,17 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.Pages; +using WeatherForecast.Models.Abstractions; using WeatherForecast.Models.PageSections; namespace WeatherForecast.Models.Pages { - public class ShopItemPageModel : PageModel { + public class ShopItemPageModel : PageModelBase { public ProductSectionModel ProductSection { get; set; } public RelatedProductsSectionModel RelatedProductsSection { get; set; } + + public ShopItemPageModel(ShopItemPage shopItemPage) : base() { + ProductSection = new ProductSectionModel(shopItemPage.ProductSection); + RelatedProductsSection = new RelatedProductsSectionModel(shopItemPage.RelatedProductsSection); + + + } } } diff --git a/webapi/WeatherForecast/Models/Responses/GetContentResponseModel.cs b/webapi/WeatherForecast/Models/Responses/GetContentResponseModel.cs index 7d3319b..9d6a65f 100644 --- a/webapi/WeatherForecast/Models/Responses/GetContentResponseModel.cs +++ b/webapi/WeatherForecast/Models/Responses/GetContentResponseModel.cs @@ -2,6 +2,7 @@ using Core.DomainObjects; using Core.DomainObjects.Documents; using WeatherForecast.Models.Pages; +using WeatherForecast.Models.PageSections; namespace WeatherForecast.Models.Responses { @@ -20,58 +21,51 @@ namespace WeatherForecast.Models.Responses { public List TopMenu { get; set; } public List SideMenu { get; set; } + /// + /// Home page static front end content + /// public HomePageModel HomePage { get; set; } + /// + /// Shop catalog page static front end content + /// public ShopCatalogPageModel ShopCatalog { get; set; } + + /// + /// Shop item page static front end content + /// public ShopItemPageModel ShopItem { get; set; } - public BlogCatalogPageModel BlogCatalog { get; set; } - public BlogItemPageModel Blogitem { get; set; } + public ShopCartPageModel ShopCart { get; set; } + public ShopCheckoutPageModel ShopCheckout { get; set; } - public GetContentResponseModel (Content domainObject) { + + public BlogCatalogPageModel BlogCatalog { get; set; } + public BlogItemPageModel BlogItem { get; set; } + + public GetContentResponseModel(Content domainObject) { SiteName = domainObject.SiteName; SiteUrl = domainObject.SiteUrl; - Header = new HeaderModel { - Title = domainObject.Header.Title, - Link = domainObject.Header.Link, - Meta = domainObject.Header.Meta - }; + Header = new HeaderModel(domainObject.Header); + Localization = new LocalizationModel(domainObject.Localization); - Localization = new LocalizationModel { - TimeZone = domainObject.Localization.TimeZone, - Locale = domainObject.Localization.Locale, - DateFormat = domainObject.Localization.DateFormat, - TimeFormat = domainObject.Localization.TimeFormat, - Currency = domainObject.Localization.Currency, - CurrencySymbol = domainObject.Localization.CurrencySymbol - }; + Routes = domainObject.Routes.Select(x => new RouteModel(x)).ToList(); + AdminRoutes = domainObject.AdminRoutes.Select(x => new RouteModel(x)).ToList(); + ServiceRoutes = domainObject.ServiceRoutes.Select(x => new RouteModel(x)).ToList(); - RouteModel ToRouteModel (Core.DomainObjects.Route route) { - return new RouteModel { - Target = route.Target, - Component = route.Component, - ChildRoutes = route.ChildRoutes?.Select(x => ToRouteModel(x)).ToList() - }; - } + TopMenu = domainObject.TopMenu.Select(x => new MenuItemModel(x)).ToList(); + SideMenu = domainObject.SideMenu.Select(x => new MenuItemModel(x)).ToList(); - Routes = domainObject.Routes.Select(x => ToRouteModel(x)).ToList(); - AdminRoutes = domainObject.AdminRoutes.Select(x => ToRouteModel(x)).ToList(); - ServiceRoutes = domainObject.ServiceRoutes.Select(x => ToRouteModel(x)).ToList(); + HomePage = new HomePageModel(domainObject.HomePage); + ShopCatalog = new ShopCatalogPageModel(domainObject.ShopCatalog); + ShopItem = new ShopItemPageModel(domainObject.ShopItem); + ShopCart = new ShopCartPageModel(domainObject.ShopCart); + ShopCheckout = new ShopCheckoutPageModel(domainObject.ShopCheckout); - MenuItemModel ToMenuItemModel (MenuItem item) { - return new MenuItemModel { - Title = item.Title, - Target = item.Target, - ChildItems = item.ChildItems?.Select(x => ToMenuItemModel(x)).ToList() - }; - } - - TopMenu = domainObject.TopMenu.Select(x => ToMenuItemModel(x)).ToList(); - SideMenu = domainObject.SideMenu.Select(x => ToMenuItemModel(x)).ToList(); + BlogCatalog = new BlogCatalogPageModel(domainObject.BlogCatalog); + BlogItem = new BlogItemPageModel(domainObject.BlogItem); } - - } } diff --git a/webapi/WeatherForecast/Models/ReviewerModel.cs b/webapi/WeatherForecast/Models/ReviewerModel.cs index 29420ae..df17219 100644 --- a/webapi/WeatherForecast/Models/ReviewerModel.cs +++ b/webapi/WeatherForecast/Models/ReviewerModel.cs @@ -1,8 +1,14 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects; +using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models { - public class ReviewerModel : PersonModel { + public class ReviewerModel : PersonModelBase { public string FullName { get; set; } public string Position { get; set; } + + public ReviewerModel(Reviewer reviewer) : base(reviewer.Image) { + FullName = reviewer.FullName; + Position = reviewer.Position; + } } } diff --git a/webapi/WeatherForecast/Models/RouteModel.cs b/webapi/WeatherForecast/Models/RouteModel.cs index 3073216..4c4c614 100644 --- a/webapi/WeatherForecast/Models/RouteModel.cs +++ b/webapi/WeatherForecast/Models/RouteModel.cs @@ -4,6 +4,10 @@ public string? Component { get; set; } public List? ChildRoutes { get; set; } - + public RouteModel(Core.DomainObjects.Route route) { + Target = route.Target; + Component = route.Component; + ChildRoutes = route.ChildRoutes?.Select(x => new RouteModel(x)).ToList(); + } } } diff --git a/webapi/WeatherForecast/Models/ShopItemModel.cs b/webapi/WeatherForecast/Models/ShopItemModel.cs index 5242f3a..351b017 100644 --- a/webapi/WeatherForecast/Models/ShopItemModel.cs +++ b/webapi/WeatherForecast/Models/ShopItemModel.cs @@ -1,12 +1,16 @@ -using WeatherForecast.Models.Abstractions; +using Core.DomainObjects.Documents; +using Core.DomainObjects.Pages; +using WeatherForecast.Models.Abstractions; namespace WeatherForecast.Models { - public class ShopItemModel : PostItemModel { + public class ShopItemModel : PostItemModelBase { public List? Images { get; set; } public string Sku { get; set; } public double? Rating { get; set; } public double Price { get; set; } public double? NewPrice { get; set; } public int? Quantity { get; set; } + + } } diff --git a/webapi/WeatherForecast/Models/TestimonialModel.cs b/webapi/WeatherForecast/Models/TestimonialModel.cs index 19b4fb4..130dd2c 100644 --- a/webapi/WeatherForecast/Models/TestimonialModel.cs +++ b/webapi/WeatherForecast/Models/TestimonialModel.cs @@ -1,6 +1,13 @@ -namespace WeatherForecast.Models { +using Core.DomainObjects; + +namespace WeatherForecast.Models { public class TestimonialModel { public string Text { get; set; } public ReviewerModel Reviewer { get; set; } + + public TestimonialModel(Testimonial testimonial) { + Text = testimonial.Text; + Reviewer = new ReviewerModel(testimonial.Reviewer); + } } }