reactredux/webapi/WeatherForecast/Controllers/ShopCartItemsController.cs

47 lines
1.2 KiB
C#

using Core.Abstractions;
using Core.Enumerations;
using DomainResults.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using WeatherForecast.Models.Requests;
using WeatherForecast.Services;
namespace WeatherForecast.Controllers {
/// <summary>
///
/// </summary>
[ApiController]
[AllowAnonymous]
[Route("api/[controller]")]
public class ShopCartItemsController : ControllerBase {
private readonly ILogger<ContentController> _logger;
private readonly IShopCartItemsService _shopCartItemsService;
/// <summary>
///
/// </summary>
/// <param name="logger"></param>
public ShopCartItemsController(
ILogger<ContentController> logger,
IShopCartItemsService shopCartItemsService
) {
_logger = logger;
_shopCartItemsService = shopCartItemsService;
}
/// <summary>
///
/// </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);
return result.ToActionResult();
}
}
}