50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
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 ShopCartController : ControllerBase {
|
|
|
|
private readonly ILogger<ContentController> _logger;
|
|
private readonly IShopCartService _shopCartService;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="logger"></param>
|
|
public ShopCartController(
|
|
ILogger<ContentController> logger,
|
|
IShopCartService shopCartService
|
|
) {
|
|
_logger = logger;
|
|
_shopCartService = shopCartService;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("{siteId}/{userId}")]
|
|
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId) {
|
|
var result = _shopCartService.GetShopCart(siteId, userId);
|
|
return result.ToActionResult();
|
|
}
|
|
|
|
[HttpPut("{siteId}/{userId}/{shopCartId}")]
|
|
public IActionResult Update([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] Guid shopCartId, [FromBody] PutShopCatalogRequestModel requestData) {
|
|
var result = _shopCartService.UpdateShopCart(siteId, userId, shopCartId, requestData);
|
|
return result.ToActionResult();
|
|
}
|
|
}
|
|
}
|