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