Shady nagy/net6 (#614)
* udated to .net6 * used the .net6 version RC2 * added editconfig. * App core new Scoped Namespaces style. * BlazorAdmin new Scoped Namespaces style. * Blazor Shared new Scoped Namespaces style. * Infra new Scoped Namespaces style. * public api new Scoped Namespaces style. * web new Scoped Namespaces style. * FunctionalTests new Scoped Namespaces style. * Integrational tests new Scoped Namespaces style. * unit tests new Scoped Namespaces style. * update github action. * update github action. * change the global.
This commit is contained in:
@@ -1,43 +1,42 @@
|
||||
using MediatR;
|
||||
using System.Threading.Tasks;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.eShopWeb.Web.Features.MyOrders;
|
||||
using Microsoft.eShopWeb.Web.Features.OrderDetails;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.eShopWeb.Web.Controllers
|
||||
namespace Microsoft.eShopWeb.Web.Controllers;
|
||||
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[Authorize] // Controllers that mainly require Authorization still use Controller/View; other pages use Pages
|
||||
[Route("[controller]/[action]")]
|
||||
public class OrderController : Controller
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[Authorize] // Controllers that mainly require Authorization still use Controller/View; other pages use Pages
|
||||
[Route("[controller]/[action]")]
|
||||
public class OrderController : Controller
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
public OrderController(IMediator mediator)
|
||||
{
|
||||
private readonly IMediator _mediator;
|
||||
_mediator = mediator;
|
||||
}
|
||||
|
||||
public OrderController(IMediator mediator)
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> MyOrders()
|
||||
{
|
||||
var viewModel = await _mediator.Send(new GetMyOrders(User.Identity.Name));
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
[HttpGet("{orderId}")]
|
||||
public async Task<IActionResult> Detail(int orderId)
|
||||
{
|
||||
var viewModel = await _mediator.Send(new GetOrderDetails(User.Identity.Name, orderId));
|
||||
|
||||
if (viewModel == null)
|
||||
{
|
||||
_mediator = mediator;
|
||||
return BadRequest("No such order found for this user.");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> MyOrders()
|
||||
{
|
||||
var viewModel = await _mediator.Send(new GetMyOrders(User.Identity.Name));
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
[HttpGet("{orderId}")]
|
||||
public async Task<IActionResult> Detail(int orderId)
|
||||
{
|
||||
var viewModel = await _mediator.Send(new GetOrderDetails(User.Identity.Name, orderId));
|
||||
|
||||
if (viewModel == null)
|
||||
{
|
||||
return BadRequest("No such order found for this user.");
|
||||
}
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
return View(viewModel);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user