(refactor): default xml comments
This commit is contained in:
parent
514b194c7e
commit
39a1e587f6
@ -25,7 +25,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "https://localhost:7151/api/Content/b3f39a82-6a1b-46a4-85cc-04c3b4315511?locale=en-US",
|
"raw": "https://localhost:7151/api/Content/404c8232-9048-4519-bfba-6e78dc7005ca?locale=en-US",
|
||||||
"protocol": "https",
|
"protocol": "https",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
@ -34,7 +34,7 @@
|
|||||||
"path": [
|
"path": [
|
||||||
"api",
|
"api",
|
||||||
"Content",
|
"Content",
|
||||||
"b3f39a82-6a1b-46a4-85cc-04c3b4315511"
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
],
|
],
|
||||||
"query": [
|
"query": [
|
||||||
{
|
{
|
||||||
@ -112,7 +112,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "https://localhost:7151/api/ShopCartItem/404c8232-9048-4519-bfba-6e78dc7005ca/fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60/SKU-01",
|
"raw": "https://localhost:7151/api/ShopCartItem/404c8232-9048-4519-bfba-6e78dc7005ca/fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60/SKU-01?locale=en-US",
|
||||||
"protocol": "https",
|
"protocol": "https",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
@ -124,6 +124,12 @@
|
|||||||
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
"fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
"fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60",
|
||||||
"SKU-01"
|
"SKU-01"
|
||||||
|
],
|
||||||
|
"query": [
|
||||||
|
{
|
||||||
|
"key": "locale",
|
||||||
|
"value": "en-US"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -185,7 +191,7 @@
|
|||||||
],
|
],
|
||||||
"body": {
|
"body": {
|
||||||
"mode": "raw",
|
"mode": "raw",
|
||||||
"raw": "{\r\n \"quantity\": 2\r\n}"
|
"raw": "{\r\n \"quantity\": 5\r\n}"
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "https://localhost:7151/api/ShopCartItem/404c8232-9048-4519-bfba-6e78dc7005ca/fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60/SKU-04",
|
"raw": "https://localhost:7151/api/ShopCartItem/404c8232-9048-4519-bfba-6e78dc7005ca/fdc5aa50-ee68-4bae-a8e6-b8ae2c258f60/SKU-04",
|
||||||
@ -261,7 +267,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "https://localhost:7151/api/ShopCatalog/404c8232-9048-4519-bfba-6e78dc7005ca?currentPage=1&itemsPerPage=4",
|
"raw": "https://localhost:7151/api/ShopItems/404c8232-9048-4519-bfba-6e78dc7005ca?currentPage=1&itemsPerPage=4",
|
||||||
"protocol": "https",
|
"protocol": "https",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
@ -269,7 +275,7 @@
|
|||||||
"port": "7151",
|
"port": "7151",
|
||||||
"path": [
|
"path": [
|
||||||
"api",
|
"api",
|
||||||
"ShopCatalog",
|
"ShopItems",
|
||||||
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
],
|
],
|
||||||
"query": [
|
"query": [
|
||||||
@ -286,6 +292,52 @@
|
|||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "01-Get localized",
|
||||||
|
"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/ShopItems/404c8232-9048-4519-bfba-6e78dc7005ca?currentPage=2&itemsPerPage=2&locale=en-US",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"ShopItems",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
],
|
||||||
|
"query": [
|
||||||
|
{
|
||||||
|
"key": "currentPage",
|
||||||
|
"value": "2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "itemsPerPage",
|
||||||
|
"value": "2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "locale",
|
||||||
|
"value": "en-US"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "01-Delete",
|
"name": "01-Delete",
|
||||||
"request": {
|
"request": {
|
||||||
@ -303,7 +355,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "https://localhost:7151/api/ShopCatalog/404c8232-9048-4519-bfba-6e78dc7005ca",
|
"raw": "https://localhost:7151/api/ShopItems/404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
"protocol": "https",
|
"protocol": "https",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
@ -311,7 +363,7 @@
|
|||||||
"port": "7151",
|
"port": "7151",
|
||||||
"path": [
|
"path": [
|
||||||
"api",
|
"api",
|
||||||
"ShopCatalog",
|
"ShopItems",
|
||||||
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -356,6 +408,44 @@
|
|||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "01-GetSlug",
|
||||||
|
"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/ShopItem/404c8232-9048-4519-bfba-6e78dc7005ca?slug=shop-catalog-item-01",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"ShopItem",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
],
|
||||||
|
"query": [
|
||||||
|
{
|
||||||
|
"key": "slug",
|
||||||
|
"value": "shop-catalog-item-01"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "02-Post",
|
"name": "02-Post",
|
||||||
"request": {
|
"request": {
|
||||||
@ -470,6 +560,48 @@
|
|||||||
"item": [
|
"item": [
|
||||||
{
|
{
|
||||||
"name": "01-Get",
|
"name": "01-Get",
|
||||||
|
"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/BlogItems/404c8232-9048-4519-bfba-6e78dc7005ca?currentPage=2&itemsPerPage=2",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"BlogItems",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
],
|
||||||
|
"query": [
|
||||||
|
{
|
||||||
|
"key": "currentPage",
|
||||||
|
"value": "2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "itemsPerPage",
|
||||||
|
"value": "2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "01-Get localized",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"header": [
|
"header": [
|
||||||
@ -550,7 +682,298 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "BlogItem",
|
"name": "BlogItem",
|
||||||
"item": []
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "01-Get",
|
||||||
|
"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/BlogItem/404c8232-9048-4519-bfba-6e78dc7005ca/11f2f5f8-1270-4640-b082-c2e7ea8e60b4",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"BlogItem",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"11f2f5f8-1270-4640-b082-c2e7ea8e60b4"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CategoryItems",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "01-Get",
|
||||||
|
"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/CategoryItems/404c8232-9048-4519-bfba-6e78dc7005ca?locale=en-US",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"CategoryItems",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
],
|
||||||
|
"query": [
|
||||||
|
{
|
||||||
|
"key": "locale",
|
||||||
|
"value": "en-US"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "01-Get Copy",
|
||||||
|
"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/CategoryItems/404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"CategoryItems",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CategoryItem",
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "01-Get",
|
||||||
|
"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/CategoryItem/404c8232-9048-4519-bfba-6e78dc7005ca/e154e33f-3cc7-468d-bb66-e0390ddb9ae0",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"CategoryItem",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"e154e33f-3cc7-468d-bb66-e0390ddb9ae0"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "01-GetSlug",
|
||||||
|
"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/CategoryItem/404c8232-9048-4519-bfba-6e78dc7005ca?slug=default",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"CategoryItem",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
],
|
||||||
|
"query": [
|
||||||
|
{
|
||||||
|
"key": "slug",
|
||||||
|
"value": "default"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "02-Post",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\r\n \"l10n\": [\r\n {\r\n \"locale\": \"en-US\",\r\n \"slug\": \"guides\",\r\n \"text\": \"Guides\"\r\n }\r\n ]\r\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "https://localhost:7151/api/CategoryItem/404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"CategoryItem",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "03-Put",
|
||||||
|
"request": {
|
||||||
|
"method": "PUT",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\r\n \"l10n\": [\r\n {\r\n \"locale\": \"en-US\",\r\n \"slug\": \"guides\",\r\n \"text\": \"Guides\"\r\n },\r\n {\r\n \"locale\": \"it-IT\",\r\n \"slug\": \"guide\",\r\n \"text\": \"Guide\"\r\n }\r\n ]\r\n}"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "https://localhost:7151/api/CategoryItem/404c8232-9048-4519-bfba-6e78dc7005ca/2c50f4de-70f2-4414-aabc-7a0d2eb0e203",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"CategoryItem",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"2c50f4de-70f2-4414-aabc-7a0d2eb0e203"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "04-Delete",
|
||||||
|
"request": {
|
||||||
|
"method": "DELETE",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "default"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": {
|
||||||
|
"raw": "https://localhost:7151/api/CategoryItem/404c8232-9048-4519-bfba-6e78dc7005ca/2c50f4de-70f2-4414-aabc-7a0d2eb0e203",
|
||||||
|
"protocol": "https",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "7151",
|
||||||
|
"path": [
|
||||||
|
"api",
|
||||||
|
"CategoryItem",
|
||||||
|
"404c8232-9048-4519-bfba-6e78dc7005ca",
|
||||||
|
"2c50f4de-70f2-4414-aabc-7a0d2eb0e203"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -60,6 +60,11 @@ namespace Core.Abstractions {
|
|||||||
return matchingItem;
|
return matchingItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public int CompareTo(object other) => Id.CompareTo(((Enumeration)other).Id);
|
public int CompareTo(object other) => Id.CompareTo(((Enumeration)other).Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10,7 +10,7 @@ namespace Core.DomainObjects {
|
|||||||
unchecked {
|
unchecked {
|
||||||
int hash = 17;
|
int hash = 17;
|
||||||
hash = hash * 23 + Id.GetHashCode();
|
hash = hash * 23 + Id.GetHashCode();
|
||||||
hash = hash + L10n.Sum(x => x.GetHashCode() * 23);
|
hash += L10n.Sum(x => x.GetHashCode() * 23);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,17 +6,17 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace DataProviders {
|
namespace DataProviders {
|
||||||
public interface IDataProvidersConfig {
|
public interface IDataProvidersConfig {
|
||||||
public Database Database { get; set; }
|
public Database? Database { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IDatabase {
|
public interface IDatabase {
|
||||||
|
|
||||||
string ConnectionString { get; set; }
|
string? ConnectionString { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Database : IDatabase {
|
public class Database : IDatabase {
|
||||||
private string _connectionString;
|
private string? _connectionString;
|
||||||
public string ConnectionString {
|
public string? ConnectionString {
|
||||||
get {
|
get {
|
||||||
var envVar = Environment.GetEnvironmentVariable("DB_CONN");
|
var envVar = Environment.GetEnvironmentVariable("DB_CONN");
|
||||||
return envVar ?? _connectionString;
|
return envVar ?? _connectionString;
|
||||||
|
|||||||
@ -1,8 +1,20 @@
|
|||||||
using DataProviders;
|
using DataProviders;
|
||||||
|
|
||||||
namespace WeatherForecast {
|
namespace WeatherForecast {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class Configuration : IDataProvidersConfig{
|
public class Configuration : IDataProvidersConfig{
|
||||||
public string Secret { get; set; }
|
|
||||||
public Database Database { get; set; }
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string? Secret { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public Database? Database { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,17 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Core.Abstractions;
|
|
||||||
using Core.Enumerations;
|
|
||||||
using WeatherForecast.Services;
|
|
||||||
using DomainResults.Mvc;
|
using DomainResults.Mvc;
|
||||||
|
|
||||||
|
using WeatherForecast.Services;
|
||||||
using WeatherForecast.Models.Requests;
|
using WeatherForecast.Models.Requests;
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers {
|
namespace WeatherForecast.Controllers {
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
@ -16,6 +20,11 @@ namespace WeatherForecast.Controllers {
|
|||||||
private readonly ILogger<BlogItemController> _logger;
|
private readonly ILogger<BlogItemController> _logger;
|
||||||
private readonly IBlogItemService _blogItemService;
|
private readonly IBlogItemService _blogItemService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="blogItemService"></param>
|
||||||
public BlogItemController(
|
public BlogItemController(
|
||||||
ILogger<BlogItemController> logger,
|
ILogger<BlogItemController> logger,
|
||||||
IBlogItemService blogItemService
|
IBlogItemService blogItemService
|
||||||
@ -47,9 +56,10 @@ namespace WeatherForecast.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns localized object
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="siteId"></param>
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="slug"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{siteId}")]
|
[HttpGet("{siteId}")]
|
||||||
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
||||||
|
|||||||
@ -1,18 +1,15 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
using Core.Models;
|
|
||||||
|
|
||||||
using WeatherForecast.Models;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Core.Abstractions.Models;
|
|
||||||
using WeatherForecast.Models.Responses;
|
|
||||||
using DomainResults.Mvc;
|
using DomainResults.Mvc;
|
||||||
|
|
||||||
using WeatherForecast.Services;
|
using WeatherForecast.Services;
|
||||||
using Core.Abstractions;
|
|
||||||
using Core.Enumerations;
|
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers;
|
namespace WeatherForecast.Controllers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
@ -21,6 +18,11 @@ public class BlogItemsController : ControllerBase {
|
|||||||
private readonly ILogger<BlogItemsController> _logger;
|
private readonly ILogger<BlogItemsController> _logger;
|
||||||
private readonly IBlogItemsService _blogItemsService;
|
private readonly IBlogItemsService _blogItemsService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="blogItemsService"></param>
|
||||||
public BlogItemsController(
|
public BlogItemsController(
|
||||||
ILogger<BlogItemsController> logger,
|
ILogger<BlogItemsController> logger,
|
||||||
IBlogItemsService blogItemsService
|
IBlogItemsService blogItemsService
|
||||||
@ -32,14 +34,16 @@ public class BlogItemsController : ControllerBase {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currentPage"></param>
|
/// <param name="siteId"></param>
|
||||||
/// <param name="itemsPerPage"></param>
|
|
||||||
/// <param name="category"></param>
|
/// <param name="category"></param>
|
||||||
/// <param name="searchText"></param>
|
/// <param name="searchText"></param>
|
||||||
|
/// <param name="currentPage"></param>
|
||||||
|
/// <param name="itemsPerPage"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{siteId}")]
|
[HttpGet("{siteId}")]
|
||||||
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] string? searchText, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string? locale) {
|
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] string? searchText, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string? locale) {
|
||||||
var result = _blogItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, Enumeration.FromDisplayName<Locales>(locale) ?? Locales.Us, searchText);
|
var result = _blogItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, locale, searchText);
|
||||||
return result.ToActionResult();
|
return result.ToActionResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,16 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using WeatherForecast.Services;
|
|
||||||
using DomainResults.Mvc;
|
using DomainResults.Mvc;
|
||||||
|
|
||||||
|
using WeatherForecast.Services;
|
||||||
using WeatherForecast.Models.Requests;
|
using WeatherForecast.Models.Requests;
|
||||||
using Core.Enumerations;
|
|
||||||
using Core.Abstractions;
|
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers {
|
namespace WeatherForecast.Controllers {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
@ -16,6 +19,11 @@ namespace WeatherForecast.Controllers {
|
|||||||
private readonly ILogger<CategoryItemController> _logger;
|
private readonly ILogger<CategoryItemController> _logger;
|
||||||
private readonly ICategoryItemService _categoryItemService;
|
private readonly ICategoryItemService _categoryItemService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="categoryItemService"></param>
|
||||||
public CategoryItemController(
|
public CategoryItemController(
|
||||||
ILogger<CategoryItemController> logger,
|
ILogger<CategoryItemController> logger,
|
||||||
ICategoryItemService categoryItemService) {
|
ICategoryItemService categoryItemService) {
|
||||||
@ -48,9 +56,10 @@ namespace WeatherForecast.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns localized object
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="siteId"></param>
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="slug"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{siteId}")]
|
[HttpGet("{siteId}")]
|
||||||
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
||||||
|
|||||||
@ -3,13 +3,13 @@ using Microsoft.AspNetCore.Authorization;
|
|||||||
|
|
||||||
using DomainResults.Mvc;
|
using DomainResults.Mvc;
|
||||||
|
|
||||||
using Core.Abstractions;
|
|
||||||
using Core.Enumerations;
|
|
||||||
|
|
||||||
using WeatherForecast.Services;
|
using WeatherForecast.Services;
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers {
|
namespace WeatherForecast.Controllers {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
@ -18,6 +18,11 @@ namespace WeatherForecast.Controllers {
|
|||||||
private readonly ILogger<CategoryItemsController> _logger;
|
private readonly ILogger<CategoryItemsController> _logger;
|
||||||
private readonly ICategoryItemsService _categoryItemsService;
|
private readonly ICategoryItemsService _categoryItemsService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="categoryItemsService"></param>
|
||||||
public CategoryItemsController(
|
public CategoryItemsController(
|
||||||
ILogger<CategoryItemsController> logger,
|
ILogger<CategoryItemsController> logger,
|
||||||
ICategoryItemsService categoryItemsService
|
ICategoryItemsService categoryItemsService
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
using DomainResults.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using WeatherForecast.Models;
|
using DomainResults.Mvc;
|
||||||
using WeatherForecast.Models.Abstractions;
|
|
||||||
using WeatherForecast.Models.Pages;
|
|
||||||
using WeatherForecast.Models.PageSections;
|
|
||||||
using WeatherForecast.Models.Responses;
|
|
||||||
using WeatherForecast.Services;
|
using WeatherForecast.Services;
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers;
|
namespace WeatherForecast.Controllers;
|
||||||
@ -25,6 +22,7 @@ public class ContentController : ControllerBase {
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger"></param>
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="contentService"></param>
|
||||||
public ContentController(
|
public ContentController(
|
||||||
ILogger<ContentController> logger,
|
ILogger<ContentController> logger,
|
||||||
IContentService contentService
|
IContentService contentService
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
using Core.Abstractions;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Core.Enumerations;
|
|
||||||
using DomainResults.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using WeatherForecast.Models.Requests;
|
using DomainResults.Mvc;
|
||||||
|
|
||||||
using WeatherForecast.Services;
|
using WeatherForecast.Services;
|
||||||
|
using WeatherForecast.Models.Requests;
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers {
|
namespace WeatherForecast.Controllers {
|
||||||
|
|
||||||
@ -24,6 +24,7 @@ namespace WeatherForecast.Controllers {
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger"></param>
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="shopCartItemService"></param>
|
||||||
public ShopCartItemController(
|
public ShopCartItemController(
|
||||||
ILogger<ContentController> logger,
|
ILogger<ContentController> logger,
|
||||||
IShopCartItemService shopCartItemService
|
IShopCartItemService shopCartItemService
|
||||||
@ -51,8 +52,8 @@ namespace WeatherForecast.Controllers {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{siteId}/{userId}/{sku}")]
|
[HttpGet("{siteId}/{userId}/{sku}")]
|
||||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku, [FromQuery] string locale) {
|
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku, [FromQuery] string? locale) {
|
||||||
var result = _shopCartItemService.Get(siteId, userId, sku, Enumeration.FromDisplayName<Locales>(locale) ?? Locales.Us);
|
var result = _shopCartItemService.Get(siteId, userId, sku, locale);
|
||||||
return result.ToActionResult();
|
return result.ToActionResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
using Core.Abstractions;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Core.Enumerations;
|
|
||||||
using DomainResults.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using WeatherForecast.Models.Requests;
|
using DomainResults.Mvc;
|
||||||
|
|
||||||
using WeatherForecast.Services;
|
using WeatherForecast.Services;
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers {
|
namespace WeatherForecast.Controllers {
|
||||||
@ -24,6 +23,7 @@ namespace WeatherForecast.Controllers {
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger"></param>
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="shopCartItemsService"></param>
|
||||||
public ShopCartItemsController(
|
public ShopCartItemsController(
|
||||||
ILogger<ContentController> logger,
|
ILogger<ContentController> logger,
|
||||||
IShopCartItemsService shopCartItemsService
|
IShopCartItemsService shopCartItemsService
|
||||||
@ -37,12 +37,17 @@ namespace WeatherForecast.Controllers {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{siteId}/{userId}")]
|
[HttpGet("{siteId}/{userId}")]
|
||||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromQuery] string locale) {
|
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromQuery] string? locale) {
|
||||||
var result = _shopCartItemsService.Get(siteId, userId, Enumeration.FromDisplayName<Locales>(locale) ?? Locales.Us);
|
var result = _shopCartItemsService.Get(siteId, userId, locale);
|
||||||
return result.ToActionResult();
|
return result.ToActionResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[HttpDelete("{siteId}/{userId}")]
|
[HttpDelete("{siteId}/{userId}")]
|
||||||
public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId) {
|
public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId) {
|
||||||
var result = _shopCartItemsService.Delete(siteId, userId);
|
var result = _shopCartItemsService.Delete(siteId, userId);
|
||||||
|
|||||||
@ -1,13 +1,16 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using WeatherForecast.Services;
|
|
||||||
using DomainResults.Mvc;
|
using DomainResults.Mvc;
|
||||||
using Core.Abstractions;
|
|
||||||
using Core.Enumerations;
|
using WeatherForecast.Services;
|
||||||
using WeatherForecast.Models.Requests;
|
using WeatherForecast.Models.Requests;
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers {
|
namespace WeatherForecast.Controllers {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
@ -16,6 +19,11 @@ namespace WeatherForecast.Controllers {
|
|||||||
private readonly ILogger<ShopItemController> _logger;
|
private readonly ILogger<ShopItemController> _logger;
|
||||||
private readonly IShopItemService _shopItemService;
|
private readonly IShopItemService _shopItemService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="shopItemService"></param>
|
||||||
public ShopItemController(
|
public ShopItemController(
|
||||||
ILogger<ShopItemController> logger,
|
ILogger<ShopItemController> logger,
|
||||||
IShopItemService shopItemService
|
IShopItemService shopItemService
|
||||||
@ -50,9 +58,10 @@ namespace WeatherForecast.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns localized object
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="siteId"></param>
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="slug"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{siteId}")]
|
[HttpGet("{siteId}")]
|
||||||
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
||||||
|
|||||||
@ -1,16 +1,15 @@
|
|||||||
using Core.Abstractions;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Core.Abstractions.Models;
|
|
||||||
using Core.Enumerations;
|
|
||||||
using Core.Models;
|
|
||||||
using DomainResults.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using WeatherForecast.Models;
|
using DomainResults.Mvc;
|
||||||
using WeatherForecast.Models.Responses;
|
|
||||||
using WeatherForecast.Services;
|
using WeatherForecast.Services;
|
||||||
|
|
||||||
namespace WeatherForecast.Controllers;
|
namespace WeatherForecast.Controllers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
@ -19,26 +18,32 @@ public class ShopItemsController : ControllerBase {
|
|||||||
private readonly ILogger<ShopItemsController> _logger;
|
private readonly ILogger<ShopItemsController> _logger;
|
||||||
private readonly IShopItemsService _shopItemsService;
|
private readonly IShopItemsService _shopItemsService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="shopCatalogService"></param>
|
||||||
public ShopItemsController(
|
public ShopItemsController(
|
||||||
ILogger<ShopItemsController> logger,
|
ILogger<ShopItemsController> logger,
|
||||||
IShopItemsService shopCatalogService
|
IShopItemsService shopCatalogService
|
||||||
) {
|
) {
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_shopItemsService = shopCatalogService;
|
_shopItemsService = shopCatalogService;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
/// <param name="category"></param>
|
/// <param name="category"></param>
|
||||||
/// <param name="searchText"></param>
|
|
||||||
/// <param name="currentPage"></param>
|
/// <param name="currentPage"></param>
|
||||||
/// <param name="itemsPerPage"></param>
|
/// <param name="itemsPerPage"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <param name="searchText"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{siteId}")]
|
[HttpGet("{siteId}")]
|
||||||
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string locale, [FromQuery] string? searchText) {
|
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string? locale, [FromQuery] string? searchText) {
|
||||||
var result = _shopItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, Enumeration.FromDisplayName<Locales>(locale) ?? Locales.Us, searchText);
|
var result = _shopItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, locale, searchText);
|
||||||
return result.ToActionResult();
|
return result.ToActionResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,30 +4,38 @@ using WeatherForecast.Models.Responses;
|
|||||||
|
|
||||||
namespace WeatherForecast.Controllers;
|
namespace WeatherForecast.Controllers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class WeatherForecastController : ControllerBase
|
public class WeatherForecastController : ControllerBase {
|
||||||
{
|
private static readonly string[] Summaries = new[]
|
||||||
private static readonly string[] Summaries = new[]
|
{
|
||||||
{
|
|
||||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly ILogger<WeatherForecastController> _logger;
|
private readonly ILogger<WeatherForecastController> _logger;
|
||||||
|
|
||||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
/// <summary>
|
||||||
{
|
///
|
||||||
_logger = logger;
|
/// </summary>
|
||||||
}
|
/// <param name="logger"></param>
|
||||||
|
public WeatherForecastController(ILogger<WeatherForecastController> logger) {
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet(Name = "GetWeatherForecast")]
|
/// <summary>
|
||||||
public IEnumerable<GetWeatherForecastResponseModel> Get()
|
///
|
||||||
{
|
/// </summary>
|
||||||
return Enumerable.Range(1, 5).Select(index => new GetWeatherForecastResponseModel {
|
/// <returns></returns>
|
||||||
Date = DateTime.Now.AddDays(index),
|
[HttpGet(Name = "GetWeatherForecast")]
|
||||||
TemperatureC = Random.Shared.Next(-20, 55),
|
public IEnumerable<GetWeatherForecastResponseModel> Get() {
|
||||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
return Enumerable.Range(1, 5).Select(index => new GetWeatherForecastResponseModel {
|
||||||
})
|
Date = DateTime.Now.AddDays(index),
|
||||||
.ToArray();
|
TemperatureC = Random.Shared.Next(-20, 55),
|
||||||
}
|
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||||
|
})
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +1,57 @@
|
|||||||
using Core.Abstractions.DomainObjects;
|
using Core.Abstractions.DomainObjects;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Abstractions {
|
namespace WeatherForecast.Models.Abstractions {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
public abstract class AddressSectionModelBase<T> : PageSectionModelBase<T> {
|
public abstract class AddressSectionModelBase<T> : PageSectionModelBase<T> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel FirstName { get; set; }
|
public FormItemModel FirstName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel LastName { get; set; }
|
public FormItemModel LastName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Address { get; set; }
|
public FormItemModel Address { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Address2 { get; set; }
|
public FormItemModel Address2 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Country { get; set; }
|
public FormItemModel Country { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel State { get; set; }
|
public FormItemModel State { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel City { get; set; }
|
public FormItemModel City { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Zip { get; set; }
|
public FormItemModel Zip { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="addressSection"></param>
|
||||||
public AddressSectionModelBase(AddressSectionBase<T> addressSection) : base(addressSection) {
|
public AddressSectionModelBase(AddressSectionBase<T> addressSection) : base(addressSection) {
|
||||||
FirstName = new FormItemModel(addressSection.FirstName);
|
FirstName = new FormItemModel(addressSection.FirstName);
|
||||||
LastName = new FormItemModel(addressSection.LastName);
|
LastName = new FormItemModel(addressSection.LastName);
|
||||||
|
|||||||
@ -6,14 +6,32 @@ using Core.DomainObjects.PageSections;
|
|||||||
using WeatherForecast.Models.PageSections;
|
using WeatherForecast.Models.PageSections;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Abstractions {
|
namespace WeatherForecast.Models.Abstractions {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
public abstract class PageModelBase<T> : ModelBase {
|
public abstract class PageModelBase<T> : ModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public HeaderModel Header { get; set; }
|
public HeaderModel Header { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public TitleSectionModel? TitleSection { get; set; }
|
public TitleSectionModel? TitleSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public PageModelBase() { }
|
public PageModelBase() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pageBase"></param>
|
||||||
public PageModelBase(PageBase<T> pageBase) {
|
public PageModelBase(PageBase<T> pageBase) {
|
||||||
if(pageBase.TitleSection !=null)
|
if(pageBase.TitleSection !=null)
|
||||||
TitleSection = new TitleSectionModel(pageBase.TitleSection);
|
TitleSection = new TitleSectionModel(pageBase.TitleSection);
|
||||||
|
|||||||
@ -2,17 +2,42 @@
|
|||||||
using Core.Abstractions.Models;
|
using Core.Abstractions.Models;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Abstractions {
|
namespace WeatherForecast.Models.Abstractions {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
public abstract class PageSectionModelBase<T> : ModelBase {
|
public abstract class PageSectionModelBase<T> : ModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Title { get; set; }
|
public string? Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Text { get; set; }
|
public string? Text { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public PageSectionModelBase() { }
|
public PageSectionModelBase() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pageSectionBase"></param>
|
||||||
public PageSectionModelBase(PageSectionBase<T> pageSectionBase) {
|
public PageSectionModelBase(PageSectionBase<T> pageSectionBase) {
|
||||||
Title = pageSectionBase.Title;
|
Title = pageSectionBase.Title;
|
||||||
Text = pageSectionBase.Text;
|
Text = pageSectionBase.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title"></param>
|
||||||
|
/// <param name="text"></param>
|
||||||
public PageSectionModelBase(string? title, string? text) {
|
public PageSectionModelBase(string? title, string? text) {
|
||||||
Title = title;
|
Title = title;
|
||||||
Text = text;
|
Text = text;
|
||||||
|
|||||||
@ -3,13 +3,32 @@ using Core.Abstractions.Models;
|
|||||||
using Core.DomainObjects;
|
using Core.DomainObjects;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Abstractions {
|
namespace WeatherForecast.Models.Abstractions {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
public abstract class PersonModelBase<T> : ModelBase {
|
public abstract class PersonModelBase<T> : ModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ImageModel? Image { get; set; }
|
public ImageModel? Image { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public PersonModelBase() { }
|
public PersonModelBase() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="person"></param>
|
||||||
public PersonModelBase(PersonBase<T> person) {
|
public PersonModelBase(PersonBase<T> person) {
|
||||||
//if(person.Image != null)
|
//if(person.Image != null)
|
||||||
// Image = new ImageModel(person.Image);
|
// Image = new ImageModel(person.Image);
|
||||||
|
|||||||
@ -4,14 +4,30 @@ using WeatherForecast.Models.L10n;
|
|||||||
|
|
||||||
namespace WeatherForecast.Models.Abstractions {
|
namespace WeatherForecast.Models.Abstractions {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
public abstract class PostItemRequestModelBase<T> : RequestModelBase<T> {
|
public abstract class PostItemRequestModelBase<T> : RequestModelBase<T> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<PostItemL10nModel> L10n { get; set; }
|
public List<PostItemL10nModel> L10n { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<Guid>? Categories { get; set; }
|
public List<Guid>? Categories { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<string>? Tags { get; set; }
|
public List<string>? Tags { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public bool? FamilyFriendly { get; set; }
|
public bool? FamilyFriendly { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,40 +5,105 @@ using Core.Enumerations;
|
|||||||
using WeatherForecast.Models.L10n;
|
using WeatherForecast.Models.L10n;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Abstractions {
|
namespace WeatherForecast.Models.Abstractions {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
public abstract class PostItemResponseModelBase<T> : ResponseModelBase {
|
public abstract class PostItemResponseModelBase<T> : ResponseModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Guid SiteId { get; set; }
|
public Guid SiteId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<PostItemL10nModel>? L10n { get; set; }
|
public List<PostItemL10nModel>? L10n { get; set; }
|
||||||
|
|
||||||
#region Localized costrutor
|
#region Localized costrutor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Slug { get; set; }
|
public string? Slug { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Title { get; set; }
|
public string? Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? ShortText { get; set; }
|
public string? ShortText { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Text { get; set; }
|
public string? Text { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? PlainText { get; set; }
|
public string? PlainText { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? ContentType { get; set; }
|
public string? ContentType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<string>? Badges { get; set; }
|
public List<string>? Badges { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<ImageModel> Images { get; set; }
|
public List<ImageModel> Images { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public AuthorModel Author { get; set; }
|
public AuthorModel Author { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<string> Tags { get; set; }
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<CategoryModel> Categories { get; set; }
|
public List<CategoryModel> Categories { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public bool? FamilyFriendly { get; set; }
|
public bool? FamilyFriendly { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="postItem"></param>
|
||||||
public PostItemResponseModelBase(PostItemBase<T> postItem) {
|
public PostItemResponseModelBase(PostItemBase<T> postItem) {
|
||||||
Id = postItem.Id;
|
Id = postItem.Id;
|
||||||
SiteId = postItem.SiteId;
|
SiteId = postItem.SiteId;
|
||||||
@ -48,12 +113,23 @@ namespace WeatherForecast.Models.Abstractions {
|
|||||||
FamilyFriendly = postItem.FamilyFriendly;
|
FamilyFriendly = postItem.FamilyFriendly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="postItem"></param>
|
||||||
|
/// <param name="categories"></param>
|
||||||
public PostItemResponseModelBase(PostItemBase<T> postItem, List<Category> categories) : this(postItem) {
|
public PostItemResponseModelBase(PostItemBase<T> postItem, List<Category> categories) : this(postItem) {
|
||||||
L10n = postItem.L10n.Select(x => new PostItemL10nModel(x)).ToList();
|
L10n = postItem.L10n.Select(x => new PostItemL10nModel(x)).ToList();
|
||||||
Categories = categories.Select(x => new CategoryModel(x)).ToList();
|
Categories = categories.Select(x => new CategoryModel(x)).ToList();
|
||||||
Images = postItem.Images.Select(x => new ImageModel(x)).ToList();
|
Images = postItem.Images.Select(x => new ImageModel(x)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="postItem"></param>
|
||||||
|
/// <param name="categories"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
public PostItemResponseModelBase(PostItemBase<T> postItem, List<Category> categories, Locales locale) : this(postItem) {
|
public PostItemResponseModelBase(PostItemBase<T> postItem, List<Category> categories, Locales locale) : this(postItem) {
|
||||||
|
|
||||||
var postItemL10n = postItem.L10n.SingleOrDefault(x => x.Locale == locale);
|
var postItemL10n = postItem.L10n.SingleOrDefault(x => x.Locale == locale);
|
||||||
|
|||||||
@ -2,9 +2,21 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class AuthorModel : PersonModelBase<Author> {
|
public class AuthorModel : PersonModelBase<Author> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string NickName { get; set; }
|
public string NickName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="author"></param>
|
||||||
public AuthorModel(Author author) {
|
public AuthorModel(Author author) {
|
||||||
NickName = author.NickName;
|
NickName = author.NickName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,12 +5,28 @@ using Core.Enumerations;
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class BlogItemModel : PostItemResponseModelBase<BlogItem> {
|
public class BlogItemModel : PostItemResponseModelBase<BlogItem> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint? ReadTime { get; set; }
|
public uint? ReadTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint? Likes { get; set; }
|
public uint? Likes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="blogItem"></param>
|
||||||
|
/// <param name="categories"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
public BlogItemModel(BlogItem blogItem, List<Category> categories, Locales locale) : base(blogItem, categories, locale) {
|
public BlogItemModel(BlogItem blogItem, List<Category> categories, Locales locale) : base(blogItem, categories, locale) {
|
||||||
|
|
||||||
ReadTime = blogItem.ReadTime;
|
ReadTime = blogItem.ReadTime;
|
||||||
|
|||||||
@ -3,16 +3,40 @@ using Core.Enumerations;
|
|||||||
using WeatherForecast.Models.L10n;
|
using WeatherForecast.Models.L10n;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class CategoryModel {
|
public class CategoryModel {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<CategoryL10nModel>? L10n { get; set; }
|
public List<CategoryL10nModel>? L10n { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Slug { get; set; }
|
public string? Slug { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Text { get; set; }
|
public string? Text { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="category"></param>
|
||||||
public CategoryModel(Category category) {
|
public CategoryModel(Category category) {
|
||||||
L10n = category.L10n.Select(x => new CategoryL10nModel(x)).ToList();
|
L10n = category.L10n.Select(x => new CategoryL10nModel(x)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="category"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
public CategoryModel(Category category, Locales locale) {
|
public CategoryModel(Category category, Locales locale) {
|
||||||
var categoryL10n = category.L10n.SingleOrDefault(x => x.Locale == locale);
|
var categoryL10n = category.L10n.SingleOrDefault(x => x.Locale == locale);
|
||||||
if (categoryL10n != null) {
|
if (categoryL10n != null) {
|
||||||
|
|||||||
@ -1,7 +1,23 @@
|
|||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class CommentModel {
|
public class CommentModel {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public AuthorModel Author { get; set; }
|
public AuthorModel Author { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Comment { get; set; }
|
public string Comment { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<CommentModel>? Responses { get; set; }
|
public List<CommentModel>? Responses { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,31 @@
|
|||||||
using Core.DomainObjects;
|
using Core.DomainObjects;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class FeatureModel {
|
public class FeatureModel {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Icon { get; set; }
|
public string Icon { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="feature"></param>
|
||||||
public FeatureModel(Feature feature) {
|
public FeatureModel(Feature feature) {
|
||||||
Icon = feature.Icon;
|
Icon = feature.Icon;
|
||||||
Title = feature.Title;
|
Title = feature.Title;
|
||||||
|
|||||||
@ -1,10 +1,26 @@
|
|||||||
using Core.DomainObjects;
|
using Core.DomainObjects;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class FormItemModel {
|
public class FormItemModel {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Title { get; set; }
|
public string? Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? PlaceHolder { get; set; }
|
public string? PlaceHolder { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="formItem"></param>
|
||||||
public FormItemModel(FormItem formItem) {
|
public FormItemModel(FormItem formItem) {
|
||||||
Title = formItem.Title;
|
Title = formItem.Title;
|
||||||
PlaceHolder = formItem.PlaceHolder;
|
PlaceHolder = formItem.PlaceHolder;
|
||||||
|
|||||||
@ -2,13 +2,30 @@
|
|||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class HeaderModel {
|
public class HeaderModel {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Title { get; set; }
|
public string? Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Dictionary<string, string>? Link { get; set; }
|
public Dictionary<string, string>? Link { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Dictionary<string, string>? Meta { get; set; }
|
public Dictionary<string, string>? Meta { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="header"></param>
|
||||||
public HeaderModel(Header header) {
|
public HeaderModel(Header header) {
|
||||||
Title = header.Title;
|
Title = header.Title;
|
||||||
Link = header.Link;
|
Link = header.Link;
|
||||||
|
|||||||
@ -3,16 +3,40 @@ using Core.Enumerations;
|
|||||||
using WeatherForecast.Models.L10n;
|
using WeatherForecast.Models.L10n;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ImageModel {
|
public class ImageModel {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<ImageL10nModel>? L10n { get; set; }
|
public List<ImageL10nModel>? L10n { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Src { get; set; }
|
public string? Src { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Alt { get; set; }
|
public string? Alt { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="image"></param>
|
||||||
public ImageModel(Image image) {
|
public ImageModel(Image image) {
|
||||||
L10n = image.L10n.Select(x => new ImageL10nModel(x)).ToList();
|
L10n = image.L10n.Select(x => new ImageL10nModel(x)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="image"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
public ImageModel(Image image, Locales locale) {
|
public ImageModel(Image image, Locales locale) {
|
||||||
Src = image.Src;
|
Src = image.Src;
|
||||||
|
|
||||||
|
|||||||
@ -4,21 +4,47 @@ using Core.DomainObjects.L10n;
|
|||||||
using Core.Enumerations;
|
using Core.Enumerations;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.L10n {
|
namespace WeatherForecast.Models.L10n {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class CategoryL10nModel : ModelBase {
|
public class CategoryL10nModel : ModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Locale { get; set; }
|
public string Locale { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public CategoryL10nModel() { }
|
public CategoryL10nModel() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="categoryL10n"></param>
|
||||||
public CategoryL10nModel(CategoryL10n categoryL10n) {
|
public CategoryL10nModel(CategoryL10n categoryL10n) {
|
||||||
Locale = categoryL10n.Locale.Name;
|
Locale = categoryL10n.Locale.Name;
|
||||||
Slug = categoryL10n.Slug;
|
Slug = categoryL10n.Slug;
|
||||||
Text = categoryL10n.Text;
|
Text = categoryL10n.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CategoryL10n ToDomainObject() => new CategoryL10n {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public CategoryL10n ToDomainObject() => new() {
|
||||||
Locale = Enumeration.FromDisplayName<Locales>(Locale),
|
Locale = Enumeration.FromDisplayName<Locales>(Locale),
|
||||||
Slug = Slug,
|
Slug = Slug,
|
||||||
Text = Text
|
Text = Text
|
||||||
|
|||||||
@ -4,18 +4,41 @@ using Core.DomainObjects.L10n;
|
|||||||
using Core.Enumerations;
|
using Core.Enumerations;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.L10n {
|
namespace WeatherForecast.Models.L10n {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ImageL10nModel : ModelBase {
|
public class ImageL10nModel : ModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Locale { get; set; }
|
public string Locale { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Alt { get; set; }
|
public string Alt { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ImageL10nModel() { }
|
public ImageL10nModel() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="imageL10n"></param>
|
||||||
public ImageL10nModel(ImageL10n imageL10n) {
|
public ImageL10nModel(ImageL10n imageL10n) {
|
||||||
Locale = imageL10n.Locale.Name;
|
Locale = imageL10n.Locale.Name;
|
||||||
Alt = imageL10n.Alt;
|
Alt = imageL10n.Alt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageL10n ToDomainObject() => new ImageL10n {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ImageL10n ToDomainObject() => new() {
|
||||||
Locale = Enumeration.FromDisplayName<Locales>(Locale),
|
Locale = Enumeration.FromDisplayName<Locales>(Locale),
|
||||||
Alt = Alt
|
Alt = Alt
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,22 +4,66 @@ using Core.DomainObjects.L10n;
|
|||||||
using Core.Enumerations;
|
using Core.Enumerations;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.L10n {
|
namespace WeatherForecast.Models.L10n {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class PostItemL10nModel : ModelBase {
|
public class PostItemL10nModel : ModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Locale { get; set; }
|
public string Locale { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string ShortText { get; set; }
|
public string ShortText { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string PlainText { get; set; }
|
public string PlainText { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string ContentType { get; set; }
|
public string ContentType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<string>? Badges { get; set; }
|
public List<string>? Badges { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public PostItemL10nModel() { }
|
public PostItemL10nModel() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="postItemL10n"></param>
|
||||||
public PostItemL10nModel(PostItemL10n postItemL10n) {
|
public PostItemL10nModel(PostItemL10n postItemL10n) {
|
||||||
Locale = postItemL10n.Locale.Name;
|
Locale = postItemL10n.Locale.Name;
|
||||||
Slug = postItemL10n.Slug;
|
Slug = postItemL10n.Slug;
|
||||||
@ -31,7 +75,11 @@ namespace WeatherForecast.Models.L10n {
|
|||||||
Badges = postItemL10n.Badges;
|
Badges = postItemL10n.Badges;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PostItemL10n ToDomainObject() => new PostItemL10n {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public PostItemL10n ToDomainObject() => new() {
|
||||||
Locale = Enumeration.FromDisplayName<Locales>(Locale),
|
Locale = Enumeration.FromDisplayName<Locales>(Locale),
|
||||||
Slug = Slug,
|
Slug = Slug,
|
||||||
Description = Description,
|
Description = Description,
|
||||||
|
|||||||
@ -1,10 +1,26 @@
|
|||||||
using Core.DomainObjects;
|
using Core.DomainObjects;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class LinkModel {
|
public class LinkModel {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Target { get; set; }
|
public string? Target { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? AnchorText { get; set; }
|
public string? AnchorText { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="link"></param>
|
||||||
public LinkModel(Link link) {
|
public LinkModel(Link link) {
|
||||||
Target = link.Target;
|
Target = link.Target;
|
||||||
AnchorText = link.AnchorText;
|
AnchorText = link.AnchorText;
|
||||||
|
|||||||
@ -1,19 +1,47 @@
|
|||||||
using Core.DomainObjects;
|
using Core.DomainObjects;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class LocalizationModel {
|
public class LocalizationModel {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? TimeZone { get; set; }
|
public string? TimeZone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Locale { get; set; }
|
public string? Locale { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? DateFormat { get; set; }
|
public string? DateFormat { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? TimeFormat { get; set; }
|
public string? TimeFormat { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Currency { get; set; }
|
public string? Currency { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
public string? CurrencySymbol { get; set; }
|
public string? CurrencySymbol { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="localization"></param>
|
||||||
public LocalizationModel(Localization localization) {
|
public LocalizationModel(Localization localization) {
|
||||||
TimeZone = localization.TimeZone;
|
TimeZone = localization.TimeZone;
|
||||||
Locale = localization.Locale;
|
Locale = localization.Locale;
|
||||||
|
|||||||
@ -1,12 +1,36 @@
|
|||||||
using Core.DomainObjects;
|
using Core.DomainObjects;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class MenuItemModel {
|
public class MenuItemModel {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Icon { get; set; }
|
public string? Icon { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Title { get; set; }
|
public string? Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Target { get; set; }
|
public string? Target { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<MenuItemModel>? ChildItems { get; set; }
|
public List<MenuItemModel>? ChildItems { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="menuItem"></param>
|
||||||
public MenuItemModel(MenuItem menuItem) {
|
public MenuItemModel(MenuItem menuItem) {
|
||||||
Title = menuItem.Title;
|
Title = menuItem.Title;
|
||||||
Target = menuItem.Target;
|
Target = menuItem.Target;
|
||||||
|
|||||||
@ -2,8 +2,16 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class BillingAddressSectionModel : AddressSectionModelBase<BillingAddressSection> {
|
public class BillingAddressSectionModel : AddressSectionModelBase<BillingAddressSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="billingAddressSection"></param>
|
||||||
public BillingAddressSectionModel(BillingAddressSection billingAddressSection) : base(billingAddressSection) { }
|
public BillingAddressSectionModel(BillingAddressSection billingAddressSection) : base(billingAddressSection) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,26 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class CallToActionSectionModel : PageSectionModelBase<CallToActionSection> {
|
public class CallToActionSectionModel : PageSectionModelBase<CallToActionSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string PrivacyDisclaimer { get; set; }
|
public string PrivacyDisclaimer { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Email { get; set; }
|
public FormItemModel Email { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="callToActionSection"></param>
|
||||||
public CallToActionSectionModel(CallToActionSection callToActionSection) : base(callToActionSection) {
|
public CallToActionSectionModel(CallToActionSection callToActionSection) : base(callToActionSection) {
|
||||||
PrivacyDisclaimer = callToActionSection.PrivacyDisclaimer;
|
PrivacyDisclaimer = callToActionSection.PrivacyDisclaimer;
|
||||||
Email = new FormItemModel(callToActionSection.Email);
|
Email = new FormItemModel(callToActionSection.Email);
|
||||||
|
|||||||
@ -4,15 +4,46 @@ using Core.DomainObjects.PageSections;
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class CartProductsSectionModel : PageSectionModelBase<ProductsSection> {
|
public class CartProductsSectionModel : PageSectionModelBase<ProductsSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Product { get; set; }
|
public string Product { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Price { get; set; }
|
public string Price { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Quantity { get; set; }
|
public string Quantity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Subtotal { get; set; }
|
public string Subtotal { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public LinkModel ContinueShopping { get; set; }
|
public LinkModel ContinueShopping { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public LinkModel Checkout { get; set; }
|
public LinkModel Checkout { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="productsSection"></param>
|
||||||
public CartProductsSectionModel(ProductsSection productsSection) : base(productsSection) {
|
public CartProductsSectionModel(ProductsSection productsSection) : base(productsSection) {
|
||||||
Product = productsSection.Product;
|
Product = productsSection.Product;
|
||||||
Price = productsSection.Price;
|
Price = productsSection.Price;
|
||||||
|
|||||||
@ -2,11 +2,26 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class CheckoutSettingsSectionModel : PageSectionModelBase<SettingsSection> {
|
public class CheckoutSettingsSectionModel : PageSectionModelBase<SettingsSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string ShippingAddressSameAsBillingAddress { get; set; }
|
public string ShippingAddressSameAsBillingAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string SaveThisInformation { get; set; }
|
public string SaveThisInformation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="settingsSection"></param>
|
||||||
public CheckoutSettingsSectionModel(SettingsSection settingsSection) : base(settingsSection) {
|
public CheckoutSettingsSectionModel(SettingsSection settingsSection) : base(settingsSection) {
|
||||||
ShippingAddressSameAsBillingAddress = settingsSection.ShippingAddressSameAsBillingAddress;
|
ShippingAddressSameAsBillingAddress = settingsSection.ShippingAddressSameAsBillingAddress;
|
||||||
SaveThisInformation = settingsSection.SaveThisInformation;
|
SaveThisInformation = settingsSection.SaveThisInformation;
|
||||||
|
|||||||
@ -2,14 +2,31 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class CheckoutSummarySectionModel : PageSectionModelBase<SummarySection> {
|
public class CheckoutSummarySectionModel : PageSectionModelBase<SummarySection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Total { get; set; }
|
public string Total { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel PromoCode { get; set; }
|
public FormItemModel PromoCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Submit { get; set; }
|
public FormItemModel Submit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="summarySection"></param>
|
||||||
public CheckoutSummarySectionModel(SummarySection summarySection) : base(summarySection) {
|
public CheckoutSummarySectionModel(SummarySection summarySection) : base(summarySection) {
|
||||||
Total = summarySection.Total;
|
Total = summarySection.Total;
|
||||||
PromoCode = new FormItemModel(summarySection.PromoCode);
|
PromoCode = new FormItemModel(summarySection.PromoCode);
|
||||||
|
|||||||
@ -2,9 +2,21 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class CommentsSectionModel : PageSectionModelBase<CommentsSection> {
|
public class CommentsSectionModel : PageSectionModelBase<CommentsSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string LeaveComment { get; set; }
|
public string LeaveComment { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="commentsSection"></param>
|
||||||
public CommentsSectionModel(CommentsSection commentsSection) : base (commentsSection) {
|
public CommentsSectionModel(CommentsSection commentsSection) : base (commentsSection) {
|
||||||
|
|
||||||
LeaveComment = commentsSection.LeaveComment;
|
LeaveComment = commentsSection.LeaveComment;
|
||||||
|
|||||||
@ -2,11 +2,26 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class FeaturedBlogSectionModel : PageSectionModelBase<FeaturedBlogSection> {
|
public class FeaturedBlogSectionModel : PageSectionModelBase<FeaturedBlogSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string ReadTime { get; set; }
|
public string ReadTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FeaturedBlogSectionModel() : base() { }
|
public FeaturedBlogSectionModel() : base() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="featuredBlogSection"></param>
|
||||||
public FeaturedBlogSectionModel(FeaturedBlogSection featuredBlogSection) : base(featuredBlogSection) {
|
public FeaturedBlogSectionModel(FeaturedBlogSection featuredBlogSection) : base(featuredBlogSection) {
|
||||||
ReadTime = featuredBlogSection.ReadTime;
|
ReadTime = featuredBlogSection.ReadTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,16 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class FeaturedBlogsSectionModel : PageSectionModelBase<FeaturedBlogsSection> {
|
public class FeaturedBlogsSectionModel : PageSectionModelBase<FeaturedBlogsSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="featuredBlogsSection"></param>
|
||||||
public FeaturedBlogsSectionModel(FeaturedBlogsSection featuredBlogsSection) : base(featuredBlogsSection) { }
|
public FeaturedBlogsSectionModel(FeaturedBlogsSection featuredBlogsSection) : base(featuredBlogsSection) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,21 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class FeaturesSectionModel : PageSectionModelBase<FeaturesSection> {
|
public class FeaturesSectionModel : PageSectionModelBase<FeaturesSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<FeatureModel> Items { get; set; }
|
public List<FeatureModel> Items { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="featuresSection"></param>
|
||||||
public FeaturesSectionModel(FeaturesSection featuresSection) : base(featuresSection) {
|
public FeaturesSectionModel(FeaturesSection featuresSection) : base(featuresSection) {
|
||||||
Items = featuresSection.Items.Select(x => new FeatureModel(x)).ToList();
|
Items = featuresSection.Items.Select(x => new FeatureModel(x)).ToList();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,13 +2,36 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class PaymentSectionModel : PageSectionModelBase<PaymentSection> {
|
public class PaymentSectionModel : PageSectionModelBase<PaymentSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel NameOnCard { get; set; }
|
public FormItemModel NameOnCard { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel CardNumber { get; set; }
|
public FormItemModel CardNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Expiration { get; set; }
|
public FormItemModel Expiration { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Cvv { get; set; }
|
public FormItemModel Cvv { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paymentSection"></param>
|
||||||
public PaymentSectionModel(PaymentSection paymentSection) : base(paymentSection) {
|
public PaymentSectionModel(PaymentSection paymentSection) : base(paymentSection) {
|
||||||
NameOnCard = new FormItemModel(paymentSection.NameOnCard);
|
NameOnCard = new FormItemModel(paymentSection.NameOnCard);
|
||||||
CardNumber = new FormItemModel(paymentSection.CardNumber);
|
CardNumber = new FormItemModel(paymentSection.CardNumber);
|
||||||
|
|||||||
@ -2,10 +2,26 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ProductSectionModel : PageSectionModelBase<ProductSection> {
|
public class ProductSectionModel : PageSectionModelBase<ProductSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string AvailableQuantity { get; set; }
|
public string AvailableQuantity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string AddToCart { get; set; }
|
public string AddToCart { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="productSection"></param>
|
||||||
public ProductSectionModel(ProductSection productSection) : base(productSection) {
|
public ProductSectionModel(ProductSection productSection) : base(productSection) {
|
||||||
AvailableQuantity = productSection.AvailableQuantity;
|
AvailableQuantity = productSection.AvailableQuantity;
|
||||||
AddToCart = productSection.AddToCart;
|
AddToCart = productSection.AddToCart;
|
||||||
|
|||||||
@ -2,10 +2,21 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class RelatedProductsSectionModel : PageSectionModelBase<RelatedProductsSection> {
|
public class RelatedProductsSectionModel : PageSectionModelBase<RelatedProductsSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string AddToCart { get; set; }
|
public string AddToCart { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="relatedProductsSection"></param>
|
||||||
public RelatedProductsSectionModel(RelatedProductsSection relatedProductsSection) : base(relatedProductsSection) {
|
public RelatedProductsSectionModel(RelatedProductsSection relatedProductsSection) : base(relatedProductsSection) {
|
||||||
AddToCart = relatedProductsSection.AddToCart;
|
AddToCart = relatedProductsSection.AddToCart;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,15 @@ using WeatherForecast.Models.Abstractions;
|
|||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShippingAddressSectionModel : AddressSectionModelBase<ShippingAddressSection> {
|
public class ShippingAddressSectionModel : AddressSectionModelBase<ShippingAddressSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shippingAddressSection"></param>
|
||||||
public ShippingAddressSectionModel(ShippingAddressSection shippingAddressSection) : base(shippingAddressSection) { }
|
public ShippingAddressSectionModel(ShippingAddressSection shippingAddressSection) : base(shippingAddressSection) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,10 +2,22 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShopItemsSectionModel : PageSectionModelBase<ShopItemsSection> {
|
public class ShopItemsSectionModel : PageSectionModelBase<ShopItemsSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string AddToCart { get; set; }
|
public string AddToCart { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shopItemSection"></param>
|
||||||
public ShopItemsSectionModel(ShopItemsSection shopItemSection) : base(shopItemSection) {
|
public ShopItemsSectionModel(ShopItemsSection shopItemSection) : base(shopItemSection) {
|
||||||
AddToCart = shopItemSection.AddToCart;
|
AddToCart = shopItemSection.AddToCart;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,10 +2,21 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class TestimonialsSectionModel : PageSectionModelBase<TestimonialsSection> {
|
public class TestimonialsSectionModel : PageSectionModelBase<TestimonialsSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<TestimonialModel> Items { get; set; }
|
public List<TestimonialModel> Items { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="testimonialsSection"></param>
|
||||||
public TestimonialsSectionModel(TestimonialsSection testimonialsSection) : base(testimonialsSection) {
|
public TestimonialsSectionModel(TestimonialsSection testimonialsSection) : base(testimonialsSection) {
|
||||||
Items = testimonialsSection.Items.Select(x => new TestimonialModel(x)).ToList();
|
Items = testimonialsSection.Items.Select(x => new TestimonialModel(x)).ToList();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,16 +2,41 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.PageSections {
|
namespace WeatherForecast.Models.PageSections {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class TitleSectionModel : PageSectionModelBase<TitleSection> {
|
public class TitleSectionModel : PageSectionModelBase<TitleSection> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ImageModel? Image { get; set; }
|
public ImageModel? Image { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public LinkModel? PrimaryLink { get; set; }
|
public LinkModel? PrimaryLink { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public LinkModel? SecondaryLink { get; set; }
|
public LinkModel? SecondaryLink { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? PostedOnBy { get; set; }
|
public string? PostedOnBy { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public TitleSectionModel() { }
|
public TitleSectionModel() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="titleSection"></param>
|
||||||
public TitleSectionModel(TitleSection titleSection) : base(titleSection) {
|
public TitleSectionModel(TitleSection titleSection) : base(titleSection) {
|
||||||
|
|
||||||
//if(titleSection.Image != null)
|
//if(titleSection.Image != null)
|
||||||
|
|||||||
@ -3,10 +3,21 @@ using WeatherForecast.Models.Abstractions;
|
|||||||
using WeatherForecast.Models.PageSections;
|
using WeatherForecast.Models.PageSections;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Pages {
|
namespace WeatherForecast.Models.Pages {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class BlogCatalogPageModel : PageModelBase<BlogCatalogPage> {
|
public class BlogCatalogPageModel : PageModelBase<BlogCatalogPage> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FeaturedBlogSectionModel FeaturedBlogSection { get; set; }
|
public FeaturedBlogSectionModel FeaturedBlogSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="blogCatalogPage"></param>
|
||||||
public BlogCatalogPageModel(BlogCatalogPage blogCatalogPage) : base(blogCatalogPage) {
|
public BlogCatalogPageModel(BlogCatalogPage blogCatalogPage) : base(blogCatalogPage) {
|
||||||
FeaturedBlogSection = new FeaturedBlogSectionModel(blogCatalogPage.FeaturedBlogSection);
|
FeaturedBlogSection = new FeaturedBlogSectionModel(blogCatalogPage.FeaturedBlogSection);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,9 +3,21 @@ using WeatherForecast.Models.Abstractions;
|
|||||||
using WeatherForecast.Models.PageSections;
|
using WeatherForecast.Models.PageSections;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Pages {
|
namespace WeatherForecast.Models.Pages {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class BlogItemPageModel : PageModelBase<BlogItemPage> {
|
public class BlogItemPageModel : PageModelBase<BlogItemPage> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public CommentsSectionModel CommentsSection { get; set; }
|
public CommentsSectionModel CommentsSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="blogItemPage"></param>
|
||||||
public BlogItemPageModel(BlogItemPage blogItemPage) : base(blogItemPage) {
|
public BlogItemPageModel(BlogItemPage blogItemPage) : base(blogItemPage) {
|
||||||
CommentsSection = new CommentsSectionModel(blogItemPage.CommentsSection);
|
CommentsSection = new CommentsSectionModel(blogItemPage.CommentsSection);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,12 +3,31 @@ using WeatherForecast.Models.Abstractions;
|
|||||||
using WeatherForecast.Models.PageSections;
|
using WeatherForecast.Models.PageSections;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Pages {
|
namespace WeatherForecast.Models.Pages {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class HomePageModel : PageModelBase<HomePage> {
|
public class HomePageModel : PageModelBase<HomePage> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public TestimonialsSectionModel TestimonialsSection { get; set; }
|
public TestimonialsSectionModel TestimonialsSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FeaturedBlogsSectionModel FeaturedBlogsSection { get; set; }
|
public FeaturedBlogsSectionModel FeaturedBlogsSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public CallToActionSectionModel CallToActionSection { get; set; }
|
public CallToActionSectionModel CallToActionSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="homePage"></param>
|
||||||
public HomePageModel(HomePage homePage) : base(homePage) {
|
public HomePageModel(HomePage homePage) : base(homePage) {
|
||||||
TestimonialsSection = new TestimonialsSectionModel(homePage.TestimonialsSection);
|
TestimonialsSection = new TestimonialsSectionModel(homePage.TestimonialsSection);
|
||||||
FeaturedBlogsSection = new FeaturedBlogsSectionModel(homePage.FeaturedBlogsSection);
|
FeaturedBlogsSection = new FeaturedBlogsSectionModel(homePage.FeaturedBlogsSection);
|
||||||
|
|||||||
@ -4,10 +4,21 @@ using WeatherForecast.Models.Abstractions;
|
|||||||
using WeatherForecast.Models.PageSections;
|
using WeatherForecast.Models.PageSections;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Pages {
|
namespace WeatherForecast.Models.Pages {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShopCartPageModel : PageModelBase<ShopCartPage> {
|
public class ShopCartPageModel : PageModelBase<ShopCartPage> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public CartProductsSectionModel ProductsSection { get; set; }
|
public CartProductsSectionModel ProductsSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shopCartPage"></param>
|
||||||
public ShopCartPageModel(ShopCartPage shopCartPage) : base(shopCartPage) {
|
public ShopCartPageModel(ShopCartPage shopCartPage) : base(shopCartPage) {
|
||||||
|
|
||||||
ProductsSection = new CartProductsSectionModel(shopCartPage.ProductsSection);
|
ProductsSection = new CartProductsSectionModel(shopCartPage.ProductsSection);
|
||||||
|
|||||||
@ -3,10 +3,21 @@ using WeatherForecast.Models.Abstractions;
|
|||||||
using WeatherForecast.Models.PageSections;
|
using WeatherForecast.Models.PageSections;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Pages {
|
namespace WeatherForecast.Models.Pages {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShopCatalogPageModel : PageModelBase<ShopCatalogPage> {
|
public class ShopCatalogPageModel : PageModelBase<ShopCatalogPage> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ShopItemsSectionModel ShopItemsSection { get; set; }
|
public ShopItemsSectionModel ShopItemsSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shopCatalogPage"></param>
|
||||||
public ShopCatalogPageModel(ShopCatalogPage shopCatalogPage) : base(shopCatalogPage) {
|
public ShopCatalogPageModel(ShopCatalogPage shopCatalogPage) : base(shopCatalogPage) {
|
||||||
|
|
||||||
ShopItemsSection = new ShopItemsSectionModel(shopCatalogPage.ShopItemsSection);
|
ShopItemsSection = new ShopItemsSectionModel(shopCatalogPage.ShopItemsSection);
|
||||||
|
|||||||
@ -3,15 +3,46 @@ using WeatherForecast.Models.Abstractions;
|
|||||||
using WeatherForecast.Models.PageSections;
|
using WeatherForecast.Models.PageSections;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Pages {
|
namespace WeatherForecast.Models.Pages {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShopCheckoutPageModel : PageModelBase<ShopCheckoutPage> {
|
public class ShopCheckoutPageModel : PageModelBase<ShopCheckoutPage> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public BillingAddressSectionModel BillingAddressSection { get; set; }
|
public BillingAddressSectionModel BillingAddressSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ShippingAddressSectionModel ShippingAddressSection { get; set; }
|
public ShippingAddressSectionModel ShippingAddressSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public CheckoutSettingsSectionModel SettingsSection { get; set; }
|
public CheckoutSettingsSectionModel SettingsSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public CheckoutSummarySectionModel SummarySection { get; set; }
|
public CheckoutSummarySectionModel SummarySection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public PaymentSectionModel PaymentSection { get; set; }
|
public PaymentSectionModel PaymentSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Submit { get; set; }
|
public FormItemModel Submit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shopCheckoutPage"></param>
|
||||||
public ShopCheckoutPageModel(ShopCheckoutPage shopCheckoutPage) : base(shopCheckoutPage) {
|
public ShopCheckoutPageModel(ShopCheckoutPage shopCheckoutPage) : base(shopCheckoutPage) {
|
||||||
|
|
||||||
BillingAddressSection = new BillingAddressSectionModel(shopCheckoutPage.BillingAddressSection);
|
BillingAddressSection = new BillingAddressSectionModel(shopCheckoutPage.BillingAddressSection);
|
||||||
@ -21,7 +52,6 @@ namespace WeatherForecast.Models.Pages {
|
|||||||
PaymentSection = new PaymentSectionModel(shopCheckoutPage.PaymentSection);
|
PaymentSection = new PaymentSectionModel(shopCheckoutPage.PaymentSection);
|
||||||
|
|
||||||
Submit = new FormItemModel(shopCheckoutPage.Submit);
|
Submit = new FormItemModel(shopCheckoutPage.Submit);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,26 @@ using WeatherForecast.Models.Abstractions;
|
|||||||
using WeatherForecast.Models.PageSections;
|
using WeatherForecast.Models.PageSections;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Pages {
|
namespace WeatherForecast.Models.Pages {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShopItemPageModel : PageModelBase<ShopItemPage> {
|
public class ShopItemPageModel : PageModelBase<ShopItemPage> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ProductSectionModel ProductSection { get; set; }
|
public ProductSectionModel ProductSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public RelatedProductsSectionModel RelatedProductsSection { get; set; }
|
public RelatedProductsSectionModel RelatedProductsSection { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shopItemPage"></param>
|
||||||
public ShopItemPageModel(ShopItemPage shopItemPage) : base(shopItemPage) {
|
public ShopItemPageModel(ShopItemPage shopItemPage) : base(shopItemPage) {
|
||||||
ProductSection = new ProductSectionModel(shopItemPage.ProductSection);
|
ProductSection = new ProductSectionModel(shopItemPage.ProductSection);
|
||||||
RelatedProductsSection = new RelatedProductsSectionModel(shopItemPage.RelatedProductsSection);
|
RelatedProductsSection = new RelatedProductsSectionModel(shopItemPage.RelatedProductsSection);
|
||||||
|
|||||||
@ -2,19 +2,46 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Pages {
|
namespace WeatherForecast.Models.Pages {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class SignInPageModel : PageModelBase<SignInPage> {
|
public class SignInPageModel : PageModelBase<SignInPage> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Email { get; set; }
|
public FormItemModel Email { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Password { get; set; }
|
public FormItemModel Password { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string DontHaveAnAccount { get; set; }
|
public string DontHaveAnAccount { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public LinkModel SignUpLink { get; set; }
|
public LinkModel SignUpLink { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Submit { get; set; }
|
public FormItemModel Submit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="signInPage"></param>
|
||||||
public SignInPageModel(SignInPage signInPage) : base(signInPage) {
|
public SignInPageModel(SignInPage signInPage) : base(signInPage) {
|
||||||
|
|
||||||
Title = signInPage.Title;
|
Title = signInPage.Title;
|
||||||
|
|||||||
@ -2,17 +2,56 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Pages {
|
namespace WeatherForecast.Models.Pages {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class SignUpPageModel : PageModelBase<SignUpPage> {
|
public class SignUpPageModel : PageModelBase<SignUpPage> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Username { get; set; }
|
public FormItemModel Username { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Email { get; set; }
|
public FormItemModel Email { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel ReEmail { get; set; }
|
public FormItemModel ReEmail { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Password { get; set; }
|
public FormItemModel Password { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel RePassword { get; set; }
|
public FormItemModel RePassword { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string AcceptTermsAndConditions { get; set; }
|
public string AcceptTermsAndConditions { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public FormItemModel Submit { get; set; }
|
public FormItemModel Submit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="signUpPage"></param>
|
||||||
public SignUpPageModel(SignUpPage signUpPage) : base(signUpPage) {
|
public SignUpPageModel(SignUpPage signUpPage) : base(signUpPage) {
|
||||||
Title = signUpPage.Title;
|
Title = signUpPage.Title;
|
||||||
Username = new FormItemModel(signUpPage.Username);
|
Username = new FormItemModel(signUpPage.Username);
|
||||||
|
|||||||
@ -3,11 +3,27 @@ using Core.DomainObjects.Documents;
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class PostBlogItemRequestModel : PostItemRequestModelBase<BlogItem> {
|
public class PostBlogItemRequestModel : PostItemRequestModelBase<BlogItem> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint? ReadTime { get; set; }
|
public uint? ReadTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint? Likes { get; set; }
|
public uint? Likes { get; set; }
|
||||||
|
|
||||||
public override BlogItem ToDomainObject() => new BlogItem {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override BlogItem ToDomainObject() => new() {
|
||||||
L10n = L10n.Select(x => x.ToDomainObject()).ToList(),
|
L10n = L10n.Select(x => x.ToDomainObject()).ToList(),
|
||||||
// Images
|
// Images
|
||||||
// Author
|
// Author
|
||||||
|
|||||||
@ -4,10 +4,22 @@ using Core.DomainObjects.L10n;
|
|||||||
using WeatherForecast.Models.L10n;
|
using WeatherForecast.Models.L10n;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class PostCategoryItemRequestModel : RequestModelBase<Category> {
|
public class PostCategoryItemRequestModel : RequestModelBase<Category> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<CategoryL10nModel> L10n { get; set; }
|
public List<CategoryL10nModel> L10n { get; set; }
|
||||||
public override Category ToDomainObject() => new Category {
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override Category ToDomainObject() => new() {
|
||||||
L10n = L10n.Select(x => x.ToDomainObject()).ToList()
|
L10n = L10n.Select(x => x.ToDomainObject()).ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,22 @@ using Core.DomainObjects;
|
|||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects.Documents;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class PostShopCartItemRequestModel : RequestModelBase<ShopCartItem> {
|
public class PostShopCartItemRequestModel : RequestModelBase<ShopCartItem> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint Quantity { get; set; }
|
public uint Quantity { get; set; }
|
||||||
|
|
||||||
public override ShopCartItem ToDomainObject() => new ShopCartItem {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override ShopCartItem ToDomainObject() => new() {
|
||||||
Quantity = Quantity,
|
Quantity = Quantity,
|
||||||
Created = DateTime.UtcNow
|
Created = DateTime.UtcNow
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,14 +6,42 @@ using ExtensionMethods;
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class PostShopItemRequestModel : PostItemRequestModelBase<ShopItem> {
|
public class PostShopItemRequestModel : PostItemRequestModelBase<ShopItem> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string BrandName { get; set; }
|
public string BrandName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public decimal? Rating { get; set; }
|
public decimal? Rating { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public decimal Price { get; set; }
|
public decimal Price { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public decimal? NewPrice { get; set; }
|
public decimal? NewPrice { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint Quantity { get; set; }
|
public uint Quantity { get; set; }
|
||||||
|
|
||||||
public override ShopItem ToDomainObject() => new ShopItem {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override ShopItem ToDomainObject() => new() {
|
||||||
L10n = L10n.Select(x => x.ToDomainObject()).ToList(),
|
L10n = L10n.Select(x => x.ToDomainObject()).ToList(),
|
||||||
// Images
|
// Images
|
||||||
// Author
|
// Author
|
||||||
|
|||||||
@ -3,11 +3,27 @@ using Core.DomainObjects.Documents;
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
public class PutBlogItemRequestModel : PostItemRequestModelBase<BlogItem> {
|
|
||||||
public uint? ReadTime { get; set; }
|
|
||||||
public uint? Likes { get; set; }
|
|
||||||
|
|
||||||
public override BlogItem ToDomainObject() => new BlogItem {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class PutBlogItemRequestModel : PostItemRequestModelBase<BlogItem> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public uint? ReadTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public uint? Likes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override BlogItem ToDomainObject() => new() {
|
||||||
L10n = L10n.Select(x => x.ToDomainObject()).ToList(),
|
L10n = L10n.Select(x => x.ToDomainObject()).ToList(),
|
||||||
// Images
|
// Images
|
||||||
// Author
|
// Author
|
||||||
|
|||||||
@ -3,9 +3,22 @@ using Core.DomainObjects;
|
|||||||
using WeatherForecast.Models.L10n;
|
using WeatherForecast.Models.L10n;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class PutCategoryItemRequestModel : RequestModelBase<Category> {
|
public class PutCategoryItemRequestModel : RequestModelBase<Category> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<CategoryL10nModel> L10n { get; set; }
|
public List<CategoryL10nModel> L10n { get; set; }
|
||||||
public override Category ToDomainObject() => new Category {
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override Category ToDomainObject() => new() {
|
||||||
L10n = L10n.Select(x => x.ToDomainObject()).ToList()
|
L10n = L10n.Select(x => x.ToDomainObject()).ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,12 +3,22 @@ using Core.DomainObjects;
|
|||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects.Documents;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class PutShopCartItemRequestModel : RequestModelBase<ShopCartItem> {
|
public class PutShopCartItemRequestModel : RequestModelBase<ShopCartItem> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint Quantity { get; set; }
|
public uint Quantity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
public override ShopCartItem ToDomainObject() => new ShopCartItem {
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override ShopCartItem ToDomainObject() => new() {
|
||||||
Quantity = Quantity
|
Quantity = Quantity
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,15 +4,42 @@ using Core.DomainObjects;
|
|||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects.Documents;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Requests {
|
namespace WeatherForecast.Models.Requests {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class PutShopItemRequestModel : PostItemRequestModelBase<ShopItem> {
|
public class PutShopItemRequestModel : PostItemRequestModelBase<ShopItem> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string BrandName { get; set; }
|
public string BrandName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public decimal? Rating { get; set; }
|
public decimal? Rating { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public decimal Price { get; set; }
|
public decimal Price { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public decimal? NewPrice { get; set; }
|
public decimal? NewPrice { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint Quantity { get; set; }
|
public uint Quantity { get; set; }
|
||||||
|
|
||||||
public override ShopItem ToDomainObject() => new ShopItem {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override ShopItem ToDomainObject() => new() {
|
||||||
L10n = L10n.Select(x => x.ToDomainObject()).ToList(),
|
L10n = L10n.Select(x => x.ToDomainObject()).ToList(),
|
||||||
// Images
|
// Images
|
||||||
// Author
|
// Author
|
||||||
|
|||||||
@ -1,7 +1,15 @@
|
|||||||
using Core.Abstractions.Models;
|
using Core.Abstractions.Models;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Responses {
|
namespace WeatherForecast.Models.Responses {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class GetBlogCategoriesResponseModel : ResponseModelBase {
|
public class GetBlogCategoriesResponseModel : ResponseModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<CategoryModel> Items { get; set; }
|
public List<CategoryModel> Items { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,17 +6,38 @@ using Core.Models;
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Responses {
|
namespace WeatherForecast.Models.Responses {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class GetBlogItemResponseModel : PostItemResponseModelBase<BlogItem> {
|
public class GetBlogItemResponseModel : PostItemResponseModelBase<BlogItem> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint? ReadTime { get; set; }
|
public uint? ReadTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint? Likes { get; set; }
|
public uint? Likes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="blogItem"></param>
|
||||||
|
/// <param name="categories"></param>
|
||||||
public GetBlogItemResponseModel(BlogItem blogItem, List<Category> categories) : base(blogItem, categories) {
|
public GetBlogItemResponseModel(BlogItem blogItem, List<Category> categories) : base(blogItem, categories) {
|
||||||
ReadTime = blogItem.ReadTime;
|
ReadTime = blogItem.ReadTime;
|
||||||
Likes = blogItem.Likes;
|
Likes = blogItem.Likes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="blogItem"></param>
|
||||||
|
/// <param name="categories"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
public GetBlogItemResponseModel(BlogItem blogItem, List<Category> categories, Locales locale) : base(blogItem, categories, locale) {
|
public GetBlogItemResponseModel(BlogItem blogItem, List<Category> categories, Locales locale) : base(blogItem, categories, locale) {
|
||||||
ReadTime = blogItem.ReadTime;
|
ReadTime = blogItem.ReadTime;
|
||||||
Likes = blogItem.Likes;
|
Likes = blogItem.Likes;
|
||||||
|
|||||||
@ -2,6 +2,10 @@
|
|||||||
using Core.Models;
|
using Core.Models;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Responses {
|
namespace WeatherForecast.Models.Responses {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class GetBlogItemsResponseModel : PaginationModelBase<GetBlogItemResponseModel> {
|
public class GetBlogItemsResponseModel : PaginationModelBase<GetBlogItemResponseModel> {
|
||||||
|
|
||||||
|
|
||||||
@ -10,7 +14,12 @@ namespace WeatherForecast.Models.Responses {
|
|||||||
//public List<CategoryModel> Categories { get; set; }
|
//public List<CategoryModel> Categories { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currentPage"></param>
|
||||||
|
/// <param name="totalPages"></param>
|
||||||
|
/// <param name="items"></param>
|
||||||
public GetBlogItemsResponseModel(int currentPage, int totalPages, List<GetBlogItemResponseModel> items)
|
public GetBlogItemsResponseModel(int currentPage, int totalPages, List<GetBlogItemResponseModel> items)
|
||||||
: base(currentPage, totalPages, items) { }
|
: base(currentPage, totalPages, items) { }
|
||||||
|
|
||||||
|
|||||||
@ -4,16 +4,41 @@ using Core.Enumerations;
|
|||||||
using WeatherForecast.Models.L10n;
|
using WeatherForecast.Models.L10n;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Responses {
|
namespace WeatherForecast.Models.Responses {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class GetCategoryItemResponseModel : ResponseModelBase {
|
public class GetCategoryItemResponseModel : ResponseModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Guid SiteId { get; set; }
|
public Guid SiteId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Slug { get; set; }
|
public string? Slug { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Text { get; set; }
|
public string? Text { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<CategoryL10nModel>? L10n { get; set; }
|
public List<CategoryL10nModel>? L10n { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="category"></param>
|
||||||
public GetCategoryItemResponseModel(Category category) {
|
public GetCategoryItemResponseModel(Category category) {
|
||||||
Id = category.Id;
|
Id = category.Id;
|
||||||
SiteId = category.SiteId;
|
SiteId = category.SiteId;
|
||||||
@ -21,6 +46,11 @@ namespace WeatherForecast.Models.Responses {
|
|||||||
L10n = category.L10n.Select(x => new CategoryL10nModel(x)).ToList();
|
L10n = category.L10n.Select(x => new CategoryL10nModel(x)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="category"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
public GetCategoryItemResponseModel(Category category, Locales locale) {
|
public GetCategoryItemResponseModel(Category category, Locales locale) {
|
||||||
Id = category.Id;
|
Id = category.Id;
|
||||||
SiteId = category.SiteId;
|
SiteId = category.SiteId;
|
||||||
|
|||||||
@ -1,24 +1,57 @@
|
|||||||
using Core.Abstractions.Models;
|
using Core.Abstractions.Models;
|
||||||
using Core.DomainObjects;
|
|
||||||
using Core.DomainObjects.Documents;
|
using Core.DomainObjects.Documents;
|
||||||
using WeatherForecast.Models.Pages;
|
using WeatherForecast.Models.Pages;
|
||||||
using WeatherForecast.Models.PageSections;
|
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Responses {
|
namespace WeatherForecast.Models.Responses {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class GetContentResponseModel : ResponseModelBase {
|
public class GetContentResponseModel : ResponseModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string SiteName { get; set; }
|
public string SiteName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string SiteUrl { get; set; }
|
public string SiteUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public HeaderModel Header { get; set; }
|
public HeaderModel Header { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public LocalizationModel Localization { get; set; }
|
public LocalizationModel Localization { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<RouteModel> Routes { get; set; }
|
public List<RouteModel> Routes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<RouteModel> AdminRoutes { get; set; }
|
public List<RouteModel> AdminRoutes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<RouteModel> ServiceRoutes { get; set; }
|
public List<RouteModel> ServiceRoutes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<MenuItemModel> TopMenu { get; set; }
|
public List<MenuItemModel> TopMenu { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<MenuItemModel> SideMenu { get; set; }
|
public List<MenuItemModel> SideMenu { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -36,16 +69,40 @@ namespace WeatherForecast.Models.Responses {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ShopItemPageModel ShopItem { get; set; }
|
public ShopItemPageModel ShopItem { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ShopCartPageModel ShopCart { get; set; }
|
public ShopCartPageModel ShopCart { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ShopCheckoutPageModel ShopCheckout { get; set; }
|
public ShopCheckoutPageModel ShopCheckout { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public BlogCatalogPageModel BlogCatalog { get; set; }
|
public BlogCatalogPageModel BlogCatalog { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public BlogItemPageModel BlogItem { get; set; }
|
public BlogItemPageModel BlogItem { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public SignInPageModel SignIn { get; set; }
|
public SignInPageModel SignIn { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public SignUpPageModel SignUp { get; set; }
|
public SignUpPageModel SignUp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="domainObject"></param>
|
||||||
public GetContentResponseModel(Content domainObject) {
|
public GetContentResponseModel(Content domainObject) {
|
||||||
|
|
||||||
SiteName = domainObject.SiteName;
|
SiteName = domainObject.SiteName;
|
||||||
|
|||||||
@ -3,20 +3,73 @@ using Core.DomainObjects.Documents;
|
|||||||
using Core.Enumerations;
|
using Core.Enumerations;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Responses {
|
namespace WeatherForecast.Models.Responses {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class GetShopCartItemResponseModel : ResponseModelBase {
|
public class GetShopCartItemResponseModel : ResponseModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Sku { get; set; }
|
public string Sku { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ImageModel Image { get; set; }
|
public ImageModel Image { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string BrandName { get; set; }
|
public string BrandName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string ShortText { get; set; }
|
public string ShortText { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public decimal Price { get; set; }
|
public decimal Price { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public decimal? NewPrice { get; set; }
|
public decimal? NewPrice { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint? Quantity { get; set; }
|
public uint? Quantity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public GetShopCartItemResponseModel() { }
|
public GetShopCartItemResponseModel() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shopItem"></param>
|
||||||
|
/// <param name="shopCartItem"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
public GetShopCartItemResponseModel(ShopItem shopItem, ShopCartItem shopCartItem, Locales locale) {
|
public GetShopCartItemResponseModel(ShopItem shopItem, ShopCartItem shopCartItem, Locales locale) {
|
||||||
|
|
||||||
Sku = shopItem.Sku;
|
Sku = shopItem.Sku;
|
||||||
|
|||||||
@ -5,14 +5,42 @@ using Core.Enumerations;
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class GetShopItemResponseModel : PostItemResponseModelBase<ShopItem> {
|
public class GetShopItemResponseModel : PostItemResponseModelBase<ShopItem> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Sku { get; set; }
|
public string Sku { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public decimal? Rating { get; set; }
|
public decimal? Rating { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public decimal Price { get; set; }
|
public decimal Price { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public decimal? NewPrice { get; set; }
|
public decimal? NewPrice { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public uint? Quantity { get; set; }
|
public uint? Quantity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shopCatalogItem"></param>
|
||||||
|
/// <param name="categories"></param>
|
||||||
public GetShopItemResponseModel(ShopItem shopCatalogItem, List<Category> categories) : base(shopCatalogItem, categories) {
|
public GetShopItemResponseModel(ShopItem shopCatalogItem, List<Category> categories) : base(shopCatalogItem, categories) {
|
||||||
Sku = shopCatalogItem.Sku;
|
Sku = shopCatalogItem.Sku;
|
||||||
Rating = shopCatalogItem.Rating;
|
Rating = shopCatalogItem.Rating;
|
||||||
@ -21,6 +49,12 @@ namespace WeatherForecast.Models {
|
|||||||
Quantity = shopCatalogItem.Quantity;
|
Quantity = shopCatalogItem.Quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="shopCatalogItem"></param>
|
||||||
|
/// <param name="categories"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
public GetShopItemResponseModel(ShopItem shopCatalogItem, List<Category> categories, Locales locale) : base(shopCatalogItem, categories, locale) {
|
public GetShopItemResponseModel(ShopItem shopCatalogItem, List<Category> categories, Locales locale) : base(shopCatalogItem, categories, locale) {
|
||||||
Sku = shopCatalogItem.Sku;
|
Sku = shopCatalogItem.Sku;
|
||||||
Rating = shopCatalogItem.Rating;
|
Rating = shopCatalogItem.Rating;
|
||||||
|
|||||||
@ -2,7 +2,18 @@
|
|||||||
using Core.Models;
|
using Core.Models;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Responses {
|
namespace WeatherForecast.Models.Responses {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class GetShopItemsResponseModel : PaginationModelBase<GetShopItemResponseModel> {
|
public class GetShopItemsResponseModel : PaginationModelBase<GetShopItemResponseModel> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currentPage"></param>
|
||||||
|
/// <param name="totalPages"></param>
|
||||||
|
/// <param name="items"></param>
|
||||||
public GetShopItemsResponseModel(int currentPage, int totalPages, List<GetShopItemResponseModel> items)
|
public GetShopItemsResponseModel(int currentPage, int totalPages, List<GetShopItemResponseModel> items)
|
||||||
: base(currentPage, totalPages, items) { }
|
: base(currentPage, totalPages, items) { }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,30 @@
|
|||||||
using Core.Abstractions.Models;
|
using Core.Abstractions.Models;
|
||||||
|
|
||||||
namespace WeatherForecast.Models.Responses {
|
namespace WeatherForecast.Models.Responses {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class GetWeatherForecastResponseModel : ResponseModelBase {
|
public class GetWeatherForecastResponseModel : ResponseModelBase {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public int TemperatureC { get; set; }
|
public int TemperatureC { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Summary { get; set; }
|
public string? Summary { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,10 +2,26 @@
|
|||||||
using WeatherForecast.Models.Abstractions;
|
using WeatherForecast.Models.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ReviewerModel : PersonModelBase<Reviewer> {
|
public class ReviewerModel : PersonModelBase<Reviewer> {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string FullName { get; set; }
|
public string FullName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Position { get; set; }
|
public string Position { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reviewer"></param>
|
||||||
public ReviewerModel(Reviewer reviewer) : base(reviewer) {
|
public ReviewerModel(Reviewer reviewer) : base(reviewer) {
|
||||||
FullName = reviewer.FullName;
|
FullName = reviewer.FullName;
|
||||||
Position = reviewer.Position;
|
Position = reviewer.Position;
|
||||||
|
|||||||
@ -1,9 +1,29 @@
|
|||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class RouteModel {
|
public class RouteModel {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Target { get; set; }
|
public string Target { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Component { get; set; }
|
public string? Component { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public List<RouteModel>? ChildRoutes { get; set; }
|
public List<RouteModel>? ChildRoutes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="route"></param>
|
||||||
public RouteModel(Core.DomainObjects.Route route) {
|
public RouteModel(Core.DomainObjects.Route route) {
|
||||||
Target = route.Target;
|
Target = route.Target;
|
||||||
Component = route.Component;
|
Component = route.Component;
|
||||||
|
|||||||
@ -1,10 +1,26 @@
|
|||||||
using Core.DomainObjects;
|
using Core.DomainObjects;
|
||||||
|
|
||||||
namespace WeatherForecast.Models {
|
namespace WeatherForecast.Models {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class TestimonialModel {
|
public class TestimonialModel {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ReviewerModel Reviewer { get; set; }
|
public ReviewerModel Reviewer { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="testimonial"></param>
|
||||||
public TestimonialModel(Testimonial testimonial) {
|
public TestimonialModel(Testimonial testimonial) {
|
||||||
Text = testimonial.Text;
|
Text = testimonial.Text;
|
||||||
Reviewer = new ReviewerModel(testimonial.Reviewer);
|
Reviewer = new ReviewerModel(testimonial.Reviewer);
|
||||||
|
|||||||
@ -1,11 +1,25 @@
|
|||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
namespace WeatherForecast {
|
namespace WeatherForecast {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class Program {
|
public class Program {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args"></param>
|
||||||
public static void Main(string[] args) {
|
public static void Main(string[] args) {
|
||||||
CreateHostBuilder(args).Build().Run();
|
CreateHostBuilder(args).Build().Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||||
Host.CreateDefaultBuilder(args)
|
Host.CreateDefaultBuilder(args)
|
||||||
.UseSerilog((hostContext, services, configuration) => {
|
.UseSerilog((hostContext, services, configuration) => {
|
||||||
|
|||||||
@ -7,19 +7,66 @@ using WeatherForecast.Models.Responses;
|
|||||||
|
|
||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IBlogItemService {
|
public interface IBlogItemService {
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="requestModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(Guid?, IDomainResult) Post(Guid siteId, PostBlogItemRequestModel requestModel);
|
(Guid?, IDomainResult) Post(Guid siteId, PostBlogItemRequestModel requestModel);
|
||||||
(GetBlogItemResponseModel, IDomainResult) Get(Guid siteId, Guid blogId);
|
|
||||||
(GetBlogItemResponseModel, IDomainResult) GetSlug(Guid siteId, string slug);
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="blogId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
(GetBlogItemResponseModel?, IDomainResult) Get(Guid siteId, Guid blogId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="slug"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
(GetBlogItemResponseModel?, IDomainResult) GetSlug(Guid siteId, string slug);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="blogId"></param>
|
||||||
|
/// <param name="requestData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(Guid?, IDomainResult) Update(Guid siteId, Guid blogId, PutBlogItemRequestModel requestData);
|
(Guid?, IDomainResult) Update(Guid siteId, Guid blogId, PutBlogItemRequestModel requestData);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="blogId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
IDomainResult Delete(Guid siteId, Guid blogId);
|
IDomainResult Delete(Guid siteId, Guid blogId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class BlogItemService : IBlogItemService {
|
public class BlogItemService : IBlogItemService {
|
||||||
private readonly ILogger<BlogItemService> _logger;
|
private readonly ILogger<BlogItemService> _logger;
|
||||||
private readonly IBlogCatalogDataProvider _blogCatalogDataProvider;
|
private readonly IBlogCatalogDataProvider _blogCatalogDataProvider;
|
||||||
private readonly ICategoryDataProvider _categoryDataProvider;
|
private readonly ICategoryDataProvider _categoryDataProvider;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="blogCatalogDataProvider"></param>
|
||||||
|
/// <param name="categoryDataProvider"></param>
|
||||||
public BlogItemService(
|
public BlogItemService(
|
||||||
ILogger<BlogItemService> logger,
|
ILogger<BlogItemService> logger,
|
||||||
IBlogCatalogDataProvider blogCatalogDataProvider,
|
IBlogCatalogDataProvider blogCatalogDataProvider,
|
||||||
@ -30,10 +77,23 @@ namespace WeatherForecast.Services {
|
|||||||
_categoryDataProvider = categoryDataProvider;
|
_categoryDataProvider = categoryDataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="requestModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public (Guid?, IDomainResult) Post(Guid siteId, PostBlogItemRequestModel requestModel) {
|
public (Guid?, IDomainResult) Post(Guid siteId, PostBlogItemRequestModel requestModel) {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="blogId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (GetBlogItemResponseModel?, IDomainResult) Get(Guid siteId, Guid blogId) {
|
public (GetBlogItemResponseModel?, IDomainResult) Get(Guid siteId, Guid blogId) {
|
||||||
var (item, result) = _blogCatalogDataProvider.Get(siteId, blogId);
|
var (item, result) = _blogCatalogDataProvider.Get(siteId, blogId);
|
||||||
|
|
||||||
@ -52,6 +112,12 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(new GetBlogItemResponseModel(item, categories));
|
return IDomainResult.Success(new GetBlogItemResponseModel(item, categories));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="slug"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (GetBlogItemResponseModel?, IDomainResult) GetSlug(Guid siteId, string slug) {
|
public (GetBlogItemResponseModel?, IDomainResult) GetSlug(Guid siteId, string slug) {
|
||||||
var (item, result) = _blogCatalogDataProvider.GetBySlug(siteId, slug);
|
var (item, result) = _blogCatalogDataProvider.GetBySlug(siteId, slug);
|
||||||
|
|
||||||
@ -72,10 +138,25 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(new GetBlogItemResponseModel(item, categories, locale));
|
return IDomainResult.Success(new GetBlogItemResponseModel(item, categories, locale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="blogId"></param>
|
||||||
|
/// <param name="requestData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public (Guid?, IDomainResult) Update(Guid siteId, Guid blogId, PutBlogItemRequestModel requestData) {
|
public (Guid?, IDomainResult) Update(Guid siteId, Guid blogId, PutBlogItemRequestModel requestData) {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="blogId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public IDomainResult Delete(Guid siteId, Guid blogId) {
|
public IDomainResult Delete(Guid siteId, Guid blogId) {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Core.DomainObjects;
|
using Core.Abstractions;
|
||||||
|
using Core.DomainObjects;
|
||||||
using Core.Enumerations;
|
using Core.Enumerations;
|
||||||
using DataProviders;
|
using DataProviders;
|
||||||
using DomainResults.Common;
|
using DomainResults.Common;
|
||||||
@ -6,17 +7,46 @@ using WeatherForecast.Models.Responses;
|
|||||||
|
|
||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IBlogItemsService {
|
public interface IBlogItemsService {
|
||||||
(GetBlogItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, Locales locale, string? searchText);
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="category"></param>
|
||||||
|
/// <param name="currentPage"></param>
|
||||||
|
/// <param name="itemsPerPage"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <param name="searchText"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
(GetBlogItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, string? locale, string? searchText);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
IDomainResult Delete(Guid siteId);
|
IDomainResult Delete(Guid siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class BlogItemsService : IBlogItemsService {
|
public class BlogItemsService : IBlogItemsService {
|
||||||
|
|
||||||
private readonly ILogger<BlogItemsService> _logger;
|
private readonly ILogger<BlogItemsService> _logger;
|
||||||
private readonly IBlogCatalogDataProvider _blogCatalogDataProvider;
|
private readonly IBlogCatalogDataProvider _blogCatalogDataProvider;
|
||||||
private readonly ICategoryDataProvider _categoryDataProvider;
|
private readonly ICategoryDataProvider _categoryDataProvider;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="blogCatalogDataProvider"></param>
|
||||||
|
/// <param name="categoryDataProvider"></param>
|
||||||
public BlogItemsService(
|
public BlogItemsService(
|
||||||
ILogger<BlogItemsService> logger,
|
ILogger<BlogItemsService> logger,
|
||||||
IBlogCatalogDataProvider blogCatalogDataProvider,
|
IBlogCatalogDataProvider blogCatalogDataProvider,
|
||||||
@ -27,7 +57,17 @@ namespace WeatherForecast.Services {
|
|||||||
_categoryDataProvider = categoryDataProvider;
|
_categoryDataProvider = categoryDataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public (GetBlogItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, Locales locale, string? searchText) {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="category"></param>
|
||||||
|
/// <param name="currentPage"></param>
|
||||||
|
/// <param name="itemsPerPage"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <param name="searchText"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public (GetBlogItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, string? locale, string? searchText) {
|
||||||
var (items, result) = _blogCatalogDataProvider.GetAll(siteId, currentPage > 0 ? ((currentPage - 1) * itemsPerPage) : 0, itemsPerPage);
|
var (items, result) = _blogCatalogDataProvider.GetAll(siteId, currentPage > 0 ? ((currentPage - 1) * itemsPerPage) : 0, itemsPerPage);
|
||||||
if (!result.IsSuccess || items == null)
|
if (!result.IsSuccess || items == null)
|
||||||
return (null, result);
|
return (null, result);
|
||||||
@ -42,7 +82,11 @@ namespace WeatherForecast.Services {
|
|||||||
|
|
||||||
categories.Add(cat);
|
categories.Add(cat);
|
||||||
}
|
}
|
||||||
blogItems.Add(new GetBlogItemResponseModel(item, categories, locale));
|
|
||||||
|
if(locale != null)
|
||||||
|
blogItems.Add(new GetBlogItemResponseModel(item, categories, Enumeration.FromDisplayName<Locales>(locale) ?? Locales.Us));
|
||||||
|
else
|
||||||
|
blogItems.Add(new GetBlogItemResponseModel(item, categories));
|
||||||
}
|
}
|
||||||
|
|
||||||
return blogItems.Count > 0
|
return blogItems.Count > 0
|
||||||
@ -50,6 +94,11 @@ namespace WeatherForecast.Services {
|
|||||||
: IDomainResult.NotFound<GetBlogItemsResponseModel?>();
|
: IDomainResult.NotFound<GetBlogItemsResponseModel?>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public IDomainResult Delete(Guid siteId) => _blogCatalogDataProvider.DeleteAll(siteId);
|
public IDomainResult Delete(Guid siteId) => _blogCatalogDataProvider.DeleteAll(siteId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,19 +5,67 @@ using WeatherForecast.Models.Requests;
|
|||||||
using WeatherForecast.Models.Responses;
|
using WeatherForecast.Models.Responses;
|
||||||
|
|
||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface ICategoryItemService {
|
public interface ICategoryItemService {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="requestModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(Guid?, IDomainResult) Post(Guid siteId, PostCategoryItemRequestModel requestModel);
|
(Guid?, IDomainResult) Post(Guid siteId, PostCategoryItemRequestModel requestModel);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="categoryId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(GetCategoryItemResponseModel?, IDomainResult) Get(Guid siteId, Guid categoryId);
|
(GetCategoryItemResponseModel?, IDomainResult) Get(Guid siteId, Guid categoryId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="slug"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(GetCategoryItemResponseModel?, IDomainResult) GetSlug(Guid siteId, string slug);
|
(GetCategoryItemResponseModel?, IDomainResult) GetSlug(Guid siteId, string slug);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="categoryId"></param>
|
||||||
|
/// <param name="requestData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(Guid?, IDomainResult) Update(Guid siteId, Guid categoryId, PutCategoryItemRequestModel requestData);
|
(Guid?, IDomainResult) Update(Guid siteId, Guid categoryId, PutCategoryItemRequestModel requestData);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="categoryId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
IDomainResult Delete(Guid siteId, Guid categoryId);
|
IDomainResult Delete(Guid siteId, Guid categoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class CategoryItemService : ICategoryItemService {
|
public class CategoryItemService : ICategoryItemService {
|
||||||
|
|
||||||
ILogger<CategoryItemService> _logger;
|
private readonly ILogger<CategoryItemService> _logger;
|
||||||
ICategoryDataProvider _categoryDataProvider;
|
private readonly ICategoryDataProvider _categoryDataProvider;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="categoryDataProvider"></param>
|
||||||
public CategoryItemService(
|
public CategoryItemService(
|
||||||
ILogger<CategoryItemService> logger,
|
ILogger<CategoryItemService> logger,
|
||||||
ICategoryDataProvider categoryDataProvider
|
ICategoryDataProvider categoryDataProvider
|
||||||
@ -26,6 +74,12 @@ namespace WeatherForecast.Services {
|
|||||||
_categoryDataProvider = categoryDataProvider;
|
_categoryDataProvider = categoryDataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="requestModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (Guid?, IDomainResult) Post(Guid siteId, PostCategoryItemRequestModel requestModel) {
|
public (Guid?, IDomainResult) Post(Guid siteId, PostCategoryItemRequestModel requestModel) {
|
||||||
var (_, getResult) = _categoryDataProvider.GetBySlugs(siteId, requestModel.L10n.Select(x => x.Slug).ToList());
|
var (_, getResult) = _categoryDataProvider.GetBySlugs(siteId, requestModel.L10n.Select(x => x.Slug).ToList());
|
||||||
if (getResult.IsSuccess)
|
if (getResult.IsSuccess)
|
||||||
@ -43,6 +97,12 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(id);
|
return IDomainResult.Success(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="categoryId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (GetCategoryItemResponseModel?, IDomainResult) Get(Guid siteId, Guid categoryId) {
|
public (GetCategoryItemResponseModel?, IDomainResult) Get(Guid siteId, Guid categoryId) {
|
||||||
var (item, result) = _categoryDataProvider.Get(siteId, categoryId);
|
var (item, result) = _categoryDataProvider.Get(siteId, categoryId);
|
||||||
if (!result.IsSuccess || item == null)
|
if (!result.IsSuccess || item == null)
|
||||||
@ -51,6 +111,12 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(new GetCategoryItemResponseModel(item));
|
return IDomainResult.Success(new GetCategoryItemResponseModel(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="slug"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (GetCategoryItemResponseModel?, IDomainResult) GetSlug(Guid siteId, string slug) {
|
public (GetCategoryItemResponseModel?, IDomainResult) GetSlug(Guid siteId, string slug) {
|
||||||
var (item, result) = _categoryDataProvider.GetBySlug(siteId, slug);
|
var (item, result) = _categoryDataProvider.GetBySlug(siteId, slug);
|
||||||
if (!result.IsSuccess || item == null)
|
if (!result.IsSuccess || item == null)
|
||||||
@ -61,6 +127,13 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(new GetCategoryItemResponseModel(item, locale));
|
return IDomainResult.Success(new GetCategoryItemResponseModel(item, locale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="categoryId"></param>
|
||||||
|
/// <param name="requestData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (Guid?, IDomainResult) Update(Guid siteId, Guid categoryId, PutCategoryItemRequestModel requestData) {
|
public (Guid?, IDomainResult) Update(Guid siteId, Guid categoryId, PutCategoryItemRequestModel requestData) {
|
||||||
var (item, result) = _categoryDataProvider.Get(siteId, categoryId);
|
var (item, result) = _categoryDataProvider.Get(siteId, categoryId);
|
||||||
if (!result.IsSuccess || item == null)
|
if (!result.IsSuccess || item == null)
|
||||||
@ -80,6 +153,12 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(item.Id);
|
return IDomainResult.Success(item.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="categoryId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public IDomainResult Delete(Guid siteId, Guid categoryId) {
|
public IDomainResult Delete(Guid siteId, Guid categoryId) {
|
||||||
var (item, getResult) = _categoryDataProvider.Get(siteId, categoryId);
|
var (item, getResult) = _categoryDataProvider.Get(siteId, categoryId);
|
||||||
if (!getResult.IsSuccess || item == null)
|
if (!getResult.IsSuccess || item == null)
|
||||||
|
|||||||
@ -6,16 +6,40 @@ using WeatherForecast.Models.Responses;
|
|||||||
|
|
||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface ICategoryItemsService {
|
public interface ICategoryItemsService {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(List<GetCategoryItemResponseModel>?, IDomainResult) Get(Guid siteId, string? locale);
|
(List<GetCategoryItemResponseModel>?, IDomainResult) Get(Guid siteId, string? locale);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
IDomainResult Delete(Guid siteId);
|
IDomainResult Delete(Guid siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class CategoryItemsService : ICategoryItemsService {
|
public class CategoryItemsService : ICategoryItemsService {
|
||||||
|
|
||||||
private readonly ILogger<CategoryItemsService> _logger;
|
private readonly ILogger<CategoryItemsService> _logger;
|
||||||
private readonly ICategoryDataProvider _categoryDataProvider;
|
private readonly ICategoryDataProvider _categoryDataProvider;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="categoryDataProvider"></param>
|
||||||
public CategoryItemsService(
|
public CategoryItemsService(
|
||||||
ILogger<CategoryItemsService> logger,
|
ILogger<CategoryItemsService> logger,
|
||||||
ICategoryDataProvider categoryDataProvider
|
ICategoryDataProvider categoryDataProvider
|
||||||
@ -24,6 +48,12 @@ namespace WeatherForecast.Services {
|
|||||||
_categoryDataProvider = categoryDataProvider;
|
_categoryDataProvider = categoryDataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (List<GetCategoryItemResponseModel>?, IDomainResult) Get(Guid siteId, string? locale) {
|
public (List<GetCategoryItemResponseModel>?, IDomainResult) Get(Guid siteId, string? locale) {
|
||||||
var (items, result) = _categoryDataProvider.GetAll(siteId);
|
var (items, result) = _categoryDataProvider.GetAll(siteId);
|
||||||
if (!result.IsSuccess || items == null)
|
if (!result.IsSuccess || items == null)
|
||||||
@ -36,6 +66,11 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(items.Select(x => new GetCategoryItemResponseModel(x)).ToList());
|
return IDomainResult.Success(items.Select(x => new GetCategoryItemResponseModel(x)).ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public IDomainResult Delete(Guid siteId) => _categoryDataProvider.DeleteAll(siteId);
|
public IDomainResult Delete(Guid siteId) => _categoryDataProvider.DeleteAll(siteId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,15 +5,33 @@ using WeatherForecast.Models.Responses;
|
|||||||
|
|
||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IContentService {
|
public interface IContentService {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(GetContentResponseModel?, IDomainResult) GetContent(Guid siteId, string locale);
|
(GetContentResponseModel?, IDomainResult) GetContent(Guid siteId, string locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ContentService : IContentService {
|
public class ContentService : IContentService {
|
||||||
|
|
||||||
private readonly ILogger<ContentService> _logger;
|
private readonly ILogger<ContentService> _logger;
|
||||||
private readonly IContentDataProvider _contentDataProvider;
|
private readonly IContentDataProvider _contentDataProvider;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="contentDataprovider"></param>
|
||||||
public ContentService(
|
public ContentService(
|
||||||
ILogger<ContentService> logger,
|
ILogger<ContentService> logger,
|
||||||
IContentDataProvider contentDataprovider
|
IContentDataProvider contentDataprovider
|
||||||
@ -22,6 +40,12 @@ namespace WeatherForecast.Services {
|
|||||||
_contentDataProvider = contentDataprovider;
|
_contentDataProvider = contentDataprovider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (GetContentResponseModel?, IDomainResult) GetContent(Guid siteId, string locale) {
|
public (GetContentResponseModel?, IDomainResult) GetContent(Guid siteId, string locale) {
|
||||||
var (content, result) = _contentDataProvider.Get(siteId, locale);
|
var (content, result) = _contentDataProvider.Get(siteId, locale);
|
||||||
|
|
||||||
@ -31,6 +55,4 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(new GetContentResponseModel(content));
|
return IDomainResult.Success(new GetContentResponseModel(content));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,19 +9,66 @@ using WeatherForecast.Models.Responses;
|
|||||||
|
|
||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IShopCartItemService {
|
public interface IShopCartItemService {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="requestModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(Guid?, IDomainResult) Post(Guid siteId, Guid userId, string sku, PostShopCartItemRequestModel requestModel);
|
(Guid?, IDomainResult) Post(Guid siteId, Guid userId, string sku, PostShopCartItemRequestModel requestModel);
|
||||||
(GetShopCartItemResponseModel?, IDomainResult) Get(Guid siteId, Guid userId, string sku, Locales locale);
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
(GetShopCartItemResponseModel?, IDomainResult) Get(Guid siteId, Guid userId, string sku, string locale = "en-US");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="requestData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(Guid?, IDomainResult) Update(Guid siteId, Guid userId, string sku, PutShopCartItemRequestModel requestData);
|
(Guid?, IDomainResult) Update(Guid siteId, Guid userId, string sku, PutShopCartItemRequestModel requestData);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <returns></returns>
|
||||||
IDomainResult Delete(Guid siteId, Guid userId, string sku);
|
IDomainResult Delete(Guid siteId, Guid userId, string sku);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShopCartItemService : IShopCartItemService {
|
public class ShopCartItemService : IShopCartItemService {
|
||||||
|
|
||||||
ILogger<ShopCartItemService> _logger;
|
private readonly ILogger<ShopCartItemService> _logger;
|
||||||
IShopCatalogDataProvider _shopCatalogDataProvider;
|
private readonly IShopCatalogDataProvider _shopCatalogDataProvider;
|
||||||
IShopCartDataProvider _shopCartDataProvider;
|
private readonly IShopCartDataProvider _shopCartDataProvider;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="shopCatalogDataProvider"></param>
|
||||||
|
/// <param name="shopCartDataprovider"></param>
|
||||||
public ShopCartItemService(
|
public ShopCartItemService(
|
||||||
ILogger<ShopCartItemService> logger,
|
ILogger<ShopCartItemService> logger,
|
||||||
IShopCatalogDataProvider shopCatalogDataProvider,
|
IShopCatalogDataProvider shopCatalogDataProvider,
|
||||||
@ -32,6 +79,14 @@ namespace WeatherForecast.Services {
|
|||||||
_shopCartDataProvider = shopCartDataprovider;
|
_shopCartDataProvider = shopCartDataprovider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="requestModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (Guid?, IDomainResult) Post(Guid siteId, Guid userId, string sku, PostShopCartItemRequestModel requestModel) {
|
public (Guid?, IDomainResult) Post(Guid siteId, Guid userId, string sku, PostShopCartItemRequestModel requestModel) {
|
||||||
var (_, getResult) = _shopCartDataProvider.Get(siteId, userId, sku);
|
var (_, getResult) = _shopCartDataProvider.Get(siteId, userId, sku);
|
||||||
if (getResult.IsSuccess)
|
if (getResult.IsSuccess)
|
||||||
@ -51,7 +106,15 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(id);
|
return IDomainResult.Success(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public (GetShopCartItemResponseModel?, IDomainResult) Get(Guid siteId, Guid userId, string sku, Locales locale) {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public (GetShopCartItemResponseModel?, IDomainResult) Get(Guid siteId, Guid userId, string sku, string locale = "en-US") {
|
||||||
|
|
||||||
var (cartItem, getCartItemResult) = _shopCartDataProvider.Get(siteId, userId, sku);
|
var (cartItem, getCartItemResult) = _shopCartDataProvider.Get(siteId, userId, sku);
|
||||||
if (!getCartItemResult.IsSuccess || cartItem == null)
|
if (!getCartItemResult.IsSuccess || cartItem == null)
|
||||||
@ -61,9 +124,17 @@ namespace WeatherForecast.Services {
|
|||||||
if (!result.IsSuccess || item == null)
|
if (!result.IsSuccess || item == null)
|
||||||
return (null, result);
|
return (null, result);
|
||||||
|
|
||||||
return IDomainResult.Success(new GetShopCartItemResponseModel(item, cartItem, locale));
|
return IDomainResult.Success(new GetShopCartItemResponseModel(item, cartItem, Enumeration.FromDisplayName<Locales>(locale)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="requestData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (Guid?, IDomainResult) Update(Guid siteId, Guid userId, string sku, PutShopCartItemRequestModel requestData) {
|
public (Guid?, IDomainResult) Update(Guid siteId, Guid userId, string sku, PutShopCartItemRequestModel requestData) {
|
||||||
var (item, getResult) = _shopCartDataProvider.Get(siteId, userId, sku);
|
var (item, getResult) = _shopCartDataProvider.Get(siteId, userId, sku);
|
||||||
if (!getResult.IsSuccess || item == null)
|
if (!getResult.IsSuccess || item == null)
|
||||||
@ -86,6 +157,13 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(item.Id);
|
return IDomainResult.Success(item.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public IDomainResult Delete(Guid siteId, Guid userId, string sku) {
|
public IDomainResult Delete(Guid siteId, Guid userId, string sku) {
|
||||||
var (item, getResult) = _shopCartDataProvider.Get(siteId, userId, sku);
|
var (item, getResult) = _shopCartDataProvider.Get(siteId, userId, sku);
|
||||||
if (!getResult.IsSuccess || item == null)
|
if (!getResult.IsSuccess || item == null)
|
||||||
|
|||||||
@ -5,20 +5,48 @@ using WeatherForecast.Models.Responses;
|
|||||||
using DataProviders;
|
using DataProviders;
|
||||||
|
|
||||||
using Core.Enumerations;
|
using Core.Enumerations;
|
||||||
|
using Core.Abstractions;
|
||||||
|
|
||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IShopCartItemsService {
|
public interface IShopCartItemsService {
|
||||||
(List<GetShopCartItemResponseModel>?, IDomainResult) Get(Guid siteId, Guid userId, Locales locale);
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
(List<GetShopCartItemResponseModel>?, IDomainResult) Get(Guid siteId, Guid userId, string locale = "en-US");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
IDomainResult Delete(Guid siteId, Guid userId);
|
IDomainResult Delete(Guid siteId, Guid userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShopCartItemsService : IShopCartItemsService {
|
public class ShopCartItemsService : IShopCartItemsService {
|
||||||
|
|
||||||
ILogger<ShopCartItemsService> _logger;
|
private readonly ILogger<ShopCartItemsService> _logger;
|
||||||
IShopCatalogDataProvider _shopCatalogDataProvider;
|
private readonly IShopCatalogDataProvider _shopCatalogDataProvider;
|
||||||
IShopCartDataProvider _shopCartDataProvider;
|
private readonly IShopCartDataProvider _shopCartDataProvider;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="shopCatalogDataProvider"></param>
|
||||||
|
/// <param name="shopCartDataprovider"></param>
|
||||||
public ShopCartItemsService(
|
public ShopCartItemsService(
|
||||||
ILogger<ShopCartItemsService> logger,
|
ILogger<ShopCartItemsService> logger,
|
||||||
IShopCatalogDataProvider shopCatalogDataProvider,
|
IShopCatalogDataProvider shopCatalogDataProvider,
|
||||||
@ -29,7 +57,14 @@ namespace WeatherForecast.Services {
|
|||||||
_shopCartDataProvider = shopCartDataprovider;
|
_shopCartDataProvider = shopCartDataprovider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public (List<GetShopCartItemResponseModel>?, IDomainResult) Get(Guid siteId, Guid userId, Locales locale) {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public (List<GetShopCartItemResponseModel>?, IDomainResult) Get(Guid siteId, Guid userId, string locale = "en-US") {
|
||||||
|
|
||||||
var (cartItems, getCartItemsResult) = _shopCartDataProvider.GetAll(siteId, userId);
|
var (cartItems, getCartItemsResult) = _shopCartDataProvider.GetAll(siteId, userId);
|
||||||
if (!getCartItemsResult.IsSuccess || cartItems == null)
|
if (!getCartItemsResult.IsSuccess || cartItems == null)
|
||||||
@ -41,7 +76,7 @@ namespace WeatherForecast.Services {
|
|||||||
if (!result.IsSuccess || item == null)
|
if (!result.IsSuccess || item == null)
|
||||||
return (null, result);
|
return (null, result);
|
||||||
|
|
||||||
items.Add(new GetShopCartItemResponseModel(item, cartItem, locale));
|
items.Add(new GetShopCartItemResponseModel(item, cartItem, Enumeration.FromDisplayName<Locales>(locale)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return items.Count > 0
|
return items.Count > 0
|
||||||
@ -49,6 +84,12 @@ namespace WeatherForecast.Services {
|
|||||||
: IDomainResult.NotFound<List<GetShopCartItemResponseModel>?>();
|
: IDomainResult.NotFound<List<GetShopCartItemResponseModel>?>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public IDomainResult Delete(Guid siteId, Guid userId) => _shopCartDataProvider.DeleteAll(siteId, userId);
|
public IDomainResult Delete(Guid siteId, Guid userId) => _shopCartDataProvider.DeleteAll(siteId, userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,21 +9,69 @@ using WeatherForecast.Models.Requests;
|
|||||||
|
|
||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IShopItemService {
|
public interface IShopItemService {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="requestModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(Guid?, IDomainResult) Post(Guid siteId, string sku, PostShopItemRequestModel requestModel);
|
(Guid?, IDomainResult) Post(Guid siteId, string sku, PostShopItemRequestModel requestModel);
|
||||||
(GetShopItemResponseModel, IDomainResult) Get(Guid siteId, string sku);
|
|
||||||
|
|
||||||
(GetShopItemResponseModel, IDomainResult) GetSlug(Guid siteId, string slug);
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
(GetShopItemResponseModel?, IDomainResult) Get(Guid siteId, string sku);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="slug"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
(GetShopItemResponseModel?, IDomainResult) GetSlug(Guid siteId, string slug);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="requestData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
(Guid?, IDomainResult) Update(Guid siteId, string sku, PutShopItemRequestModel requestData);
|
(Guid?, IDomainResult) Update(Guid siteId, string sku, PutShopItemRequestModel requestData);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <returns></returns>
|
||||||
IDomainResult Delete(Guid siteId, string sku);
|
IDomainResult Delete(Guid siteId, string sku);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShopItemService : IShopItemService {
|
public class ShopItemService : IShopItemService {
|
||||||
|
|
||||||
private readonly ILogger<ShopItemService> _logger;
|
private readonly ILogger<ShopItemService> _logger;
|
||||||
private readonly IShopCatalogDataProvider _shopCatalogDataProvider;
|
private readonly IShopCatalogDataProvider _shopCatalogDataProvider;
|
||||||
private readonly ICategoryDataProvider _categoryDataProvider;
|
private readonly ICategoryDataProvider _categoryDataProvider;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="shopCatalogDataProvider"></param>
|
||||||
|
/// <param name="categoryDataProvider"></param>
|
||||||
public ShopItemService(
|
public ShopItemService(
|
||||||
ILogger<ShopItemService> logger,
|
ILogger<ShopItemService> logger,
|
||||||
IShopCatalogDataProvider shopCatalogDataProvider,
|
IShopCatalogDataProvider shopCatalogDataProvider,
|
||||||
@ -34,6 +82,13 @@ namespace WeatherForecast.Services {
|
|||||||
_categoryDataProvider = categoryDataProvider;
|
_categoryDataProvider = categoryDataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="requestModel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (Guid?, IDomainResult) Post(Guid siteId, string sku, PostShopItemRequestModel requestModel) {
|
public (Guid?, IDomainResult) Post(Guid siteId, string sku, PostShopItemRequestModel requestModel) {
|
||||||
var (_, getResult) = _shopCatalogDataProvider.Get(siteId, sku);
|
var (_, getResult) = _shopCatalogDataProvider.Get(siteId, sku);
|
||||||
if (getResult.IsSuccess)
|
if (getResult.IsSuccess)
|
||||||
@ -71,6 +126,12 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(id);
|
return IDomainResult.Success(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (GetShopItemResponseModel?, IDomainResult) Get(Guid siteId, string sku) {
|
public (GetShopItemResponseModel?, IDomainResult) Get(Guid siteId, string sku) {
|
||||||
var (item, result) = _shopCatalogDataProvider.Get(siteId, sku);
|
var (item, result) = _shopCatalogDataProvider.Get(siteId, sku);
|
||||||
|
|
||||||
@ -78,18 +139,26 @@ namespace WeatherForecast.Services {
|
|||||||
return (null, result);
|
return (null, result);
|
||||||
|
|
||||||
var categories = new List<Category>();
|
var categories = new List<Category>();
|
||||||
foreach (var catId in item.Categories) {
|
if (item.Categories != null) {
|
||||||
var (category, getCategoryResult) = _categoryDataProvider.Get(siteId, catId);
|
foreach (var catId in item.Categories) {
|
||||||
if (!getCategoryResult.IsSuccess || category == null)
|
var (category, getCategoryResult) = _categoryDataProvider.Get(siteId, catId);
|
||||||
return (null, getCategoryResult);
|
if (!getCategoryResult.IsSuccess || category == null)
|
||||||
|
return (null, getCategoryResult);
|
||||||
|
|
||||||
categories.Add(category);
|
categories.Add(category);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return IDomainResult.Success(new GetShopItemResponseModel(item, categories));
|
return IDomainResult.Success(new GetShopItemResponseModel(item, categories));
|
||||||
}
|
}
|
||||||
|
|
||||||
public (GetShopItemResponseModel, IDomainResult) GetSlug(Guid siteId, string slug) {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="slug"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public (GetShopItemResponseModel?, IDomainResult) GetSlug(Guid siteId, string slug) {
|
||||||
var (item, result) = _shopCatalogDataProvider.GetBySlug(siteId, slug);
|
var (item, result) = _shopCatalogDataProvider.GetBySlug(siteId, slug);
|
||||||
|
|
||||||
if (!result.IsSuccess || item == null)
|
if (!result.IsSuccess || item == null)
|
||||||
@ -98,17 +167,26 @@ namespace WeatherForecast.Services {
|
|||||||
var locale = item.L10n.SingleOrDefault(x => x.Slug == slug)?.Locale ?? Locales.Us;
|
var locale = item.L10n.SingleOrDefault(x => x.Slug == slug)?.Locale ?? Locales.Us;
|
||||||
|
|
||||||
var categories = new List<Category>();
|
var categories = new List<Category>();
|
||||||
foreach (var catId in item.Categories) {
|
if (item.Categories != null) {
|
||||||
var (category, getCategoryResult) = _categoryDataProvider.Get(siteId, catId);
|
foreach (var catId in item.Categories) {
|
||||||
if (!getCategoryResult.IsSuccess || category == null)
|
var (category, getCategoryResult) = _categoryDataProvider.Get(siteId, catId);
|
||||||
return (null, getCategoryResult);
|
if (!getCategoryResult.IsSuccess || category == null)
|
||||||
|
return (null, getCategoryResult);
|
||||||
|
|
||||||
categories.Add(category);
|
categories.Add(category);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return IDomainResult.Success(new GetShopItemResponseModel(item, categories, locale));
|
return IDomainResult.Success(new GetShopItemResponseModel(item, categories, locale));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <param name="requestData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public (Guid?, IDomainResult) Update(Guid siteId, string sku, PutShopItemRequestModel requestData) {
|
public (Guid?, IDomainResult) Update(Guid siteId, string sku, PutShopItemRequestModel requestData) {
|
||||||
var (item, getResult) = _shopCatalogDataProvider.Get(siteId, sku);
|
var (item, getResult) = _shopCatalogDataProvider.Get(siteId, sku);
|
||||||
if (!getResult.IsSuccess || item == null)
|
if (!getResult.IsSuccess || item == null)
|
||||||
@ -131,6 +209,12 @@ namespace WeatherForecast.Services {
|
|||||||
return IDomainResult.Success(item.Id);
|
return IDomainResult.Success(item.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public IDomainResult Delete(Guid siteId, string sku) {
|
public IDomainResult Delete(Guid siteId, string sku) {
|
||||||
var (item, getResult) = _shopCatalogDataProvider.Get(siteId, sku);
|
var (item, getResult) = _shopCatalogDataProvider.Get(siteId, sku);
|
||||||
if (!getResult.IsSuccess || item == null)
|
if (!getResult.IsSuccess || item == null)
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Core.DomainObjects;
|
using Core.Abstractions;
|
||||||
|
using Core.DomainObjects;
|
||||||
using Core.Enumerations;
|
using Core.Enumerations;
|
||||||
using DataProviders;
|
using DataProviders;
|
||||||
using DomainResults.Common;
|
using DomainResults.Common;
|
||||||
@ -7,16 +8,45 @@ using WeatherForecast.Models.Responses;
|
|||||||
|
|
||||||
namespace WeatherForecast.Services {
|
namespace WeatherForecast.Services {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public interface IShopItemsService {
|
public interface IShopItemsService {
|
||||||
(GetShopItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, Locales locale, string? searchText);
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="category"></param>
|
||||||
|
/// <param name="currentPage"></param>
|
||||||
|
/// <param name="itemsPerPage"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <param name="searchText"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
(GetShopItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, string? locale, string? searchText);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
IDomainResult Delete(Guid siteId);
|
IDomainResult Delete(Guid siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class ShopItemsService : IShopItemsService {
|
public class ShopItemsService : IShopItemsService {
|
||||||
private readonly ILogger<ShopItemsService> _logger;
|
private readonly ILogger<ShopItemsService> _logger;
|
||||||
private readonly IShopCatalogDataProvider _shopCatalogDataProvider;
|
private readonly IShopCatalogDataProvider _shopCatalogDataProvider;
|
||||||
private readonly ICategoryDataProvider _categoryDataProvider;
|
private readonly ICategoryDataProvider _categoryDataProvider;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger"></param>
|
||||||
|
/// <param name="shopCatalogDataprovider"></param>
|
||||||
|
/// <param name="categoryDataProvider"></param>
|
||||||
public ShopItemsService(
|
public ShopItemsService(
|
||||||
ILogger<ShopItemsService> logger,
|
ILogger<ShopItemsService> logger,
|
||||||
IShopCatalogDataProvider shopCatalogDataprovider,
|
IShopCatalogDataProvider shopCatalogDataprovider,
|
||||||
@ -27,7 +57,17 @@ namespace WeatherForecast.Services {
|
|||||||
_categoryDataProvider = categoryDataProvider;
|
_categoryDataProvider = categoryDataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public (GetShopItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, Locales locale, string? searchText) {
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <param name="category"></param>
|
||||||
|
/// <param name="currentPage"></param>
|
||||||
|
/// <param name="itemsPerPage"></param>
|
||||||
|
/// <param name="locale"></param>
|
||||||
|
/// <param name="searchText"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public (GetShopItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid? category, int currentPage, int itemsPerPage, string? locale, string? searchText) {
|
||||||
var (items, result) = _shopCatalogDataProvider.GetAll(siteId, currentPage > 0 ? ((currentPage - 1) * itemsPerPage) : 0, itemsPerPage);
|
var (items, result) = _shopCatalogDataProvider.GetAll(siteId, currentPage > 0 ? ((currentPage - 1) * itemsPerPage) : 0, itemsPerPage);
|
||||||
|
|
||||||
if (!result.IsSuccess || items == null)
|
if (!result.IsSuccess || items == null)
|
||||||
@ -36,15 +76,22 @@ namespace WeatherForecast.Services {
|
|||||||
|
|
||||||
var shopItems = new List<GetShopItemResponseModel>();
|
var shopItems = new List<GetShopItemResponseModel>();
|
||||||
foreach (var item in items) {
|
foreach (var item in items) {
|
||||||
var categories = new List<Category>();
|
|
||||||
foreach (var catId in item.Categories) {
|
|
||||||
var (cat, getCategoryResult) = _categoryDataProvider.Get(siteId, catId);
|
|
||||||
if (!getCategoryResult.IsSuccess || cat == null)
|
|
||||||
return (null, getCategoryResult);
|
|
||||||
|
|
||||||
categories.Add(cat);
|
var categories = new List<Category>();
|
||||||
|
if (item.Categories != null) {
|
||||||
|
foreach (var catId in item.Categories) {
|
||||||
|
var (cat, getCategoryResult) = _categoryDataProvider.Get(siteId, catId);
|
||||||
|
if (!getCategoryResult.IsSuccess || cat == null)
|
||||||
|
return (null, getCategoryResult);
|
||||||
|
|
||||||
|
categories.Add(cat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
shopItems.Add(new GetShopItemResponseModel(item, categories, locale));
|
|
||||||
|
if(locale != null)
|
||||||
|
shopItems.Add(new GetShopItemResponseModel(item, categories, Enumeration.FromDisplayName<Locales>(locale) ?? Locales.Us));
|
||||||
|
else
|
||||||
|
shopItems.Add(new GetShopItemResponseModel(item, categories));
|
||||||
}
|
}
|
||||||
|
|
||||||
return shopItems.Count > 0
|
return shopItems.Count > 0
|
||||||
@ -52,7 +99,11 @@ namespace WeatherForecast.Services {
|
|||||||
: IDomainResult.NotFound<GetShopItemsResponseModel?>();
|
: IDomainResult.NotFound<GetShopItemsResponseModel?>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="siteId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public IDomainResult Delete(Guid siteId) => _shopCatalogDataProvider.DeleteAll(siteId);
|
public IDomainResult Delete(Guid siteId) => _shopCatalogDataProvider.DeleteAll(siteId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,17 +8,28 @@ using DataProviders.Extensions;
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace WeatherForecast {
|
namespace WeatherForecast {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class Startup {
|
public class Startup {
|
||||||
|
|
||||||
public IConfiguration _configuration { get; }
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
string MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
|
private const string MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="configuration"></param>
|
||||||
public Startup(IConfiguration configuration) {
|
public Startup(IConfiguration configuration) {
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
/// <summary>
|
||||||
|
/// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services"></param>
|
||||||
public void ConfigureServices(IServiceCollection services) {
|
public void ConfigureServices(IServiceCollection services) {
|
||||||
string serverHostName = Environment.MachineName;
|
string serverHostName = Environment.MachineName;
|
||||||
|
|
||||||
@ -38,21 +49,23 @@ namespace WeatherForecast {
|
|||||||
services.AddControllers().AddJsonOptions(options =>
|
services.AddControllers().AddJsonOptions(options =>
|
||||||
options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull);
|
options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull);
|
||||||
|
|
||||||
// configure jwt authentication
|
#region configure jwt authentication
|
||||||
services.AddAuthentication(options => {
|
if (appSettings.Secret != null) {
|
||||||
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
services.AddAuthentication(options => {
|
||||||
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
}).AddJwtBearer(options => {
|
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
options.RequireHttpsMetadata = false;
|
}).AddJwtBearer(options => {
|
||||||
options.SaveToken = true;
|
options.RequireHttpsMetadata = false;
|
||||||
options.TokenValidationParameters = new TokenValidationParameters {
|
options.SaveToken = true;
|
||||||
ValidateIssuerSigningKey = true,
|
options.TokenValidationParameters = new TokenValidationParameters {
|
||||||
IssuerSigningKey = new SymmetricSecurityKey(Convert.FromBase64String(appSettings.Secret)),
|
ValidateIssuerSigningKey = true,
|
||||||
ValidateIssuer = false,
|
IssuerSigningKey = new SymmetricSecurityKey(Convert.FromBase64String(appSettings.Secret)),
|
||||||
ValidateAudience = false
|
ValidateIssuer = false,
|
||||||
};
|
ValidateAudience = false
|
||||||
});
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
// 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();
|
||||||
@ -137,9 +150,12 @@ namespace WeatherForecast {
|
|||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
/// <summary>
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) {
|
/// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="app"></param>
|
||||||
|
/// <param name="env"></param>
|
||||||
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
|
||||||
|
|
||||||
if (env.IsDevelopment()) {
|
if (env.IsDevelopment()) {
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user