✅ MS webshop example

BObig OOF11/25/2022

Im trying to understand the different parts of a webshop example from Microsoft.

I have a question about routing, the view looks like this(see attached).

My question is regarding this line:
 <form asp-action="OrderProcess" id="orderForm+@item.OrderNumber" method="post">

I find the function OrderProcess in OrderManagementController and it takes a POST-request:
    public async Task<IActionResult> OrderProcess(string orderId, string actionCode)
        if (OrderProcessAction.Ship.Code == actionCode)
            await _orderSvc.ShipOrder(orderId);

        return RedirectToAction("Index");

To my question - how does it know in which cs file the function is located? I cant see any "connection" in the view. I cant imagine that it looks into every class to see wheter it has a OrderProcess and takes a POST-argument, but maybe im wrong? 🙂

Thanks in advance!
It takes the class whose method handled the GET request to display this form
Or rather, it POSTs to the same URL
So whichever controller handles /my/cool/form, will handle the POST request. And which action method will do it specifically, is denoted by asp-action
BObig OOF11/25/2022

A follow-up question, this is the start of the program:
    public async Task<IActionResult> Index(int? BrandFilterApplied, int? TypesFilterApplied, int? page, [FromQuery] string errorMsg)
        var itemsPage = 9;
        var catalog = await _catalogSvc.GetCatalogItems(page ?? 0, itemsPage, BrandFilterApplied, TypesFilterApplied);
        var vm = new IndexViewModel()
            CatalogItems = catalog.Data,
            Brands = await _catalogSvc.GetBrands(),
            Types = await _catalogSvc.GetTypes(),
            BrandFilterApplied = BrandFilterApplied ?? 0,
            TypesFilterApplied = TypesFilterApplied ?? 0,
            PaginationInfo = new PaginationInfo()
                ActualPage = page ?? 0,
                ItemsPerPage = catalog.Data.Count,
                TotalItems = catalog.Count,
                TotalPages = (int)Math.Ceiling(((decimal)catalog.Count / itemsPage))

        vm.PaginationInfo.Next = (vm.PaginationInfo.ActualPage == vm.PaginationInfo.TotalPages - 1) ? "is-disabled" : "";
        vm.PaginationInfo.Previous = (vm.PaginationInfo.ActualPage == 0) ? "is-disabled" : "";

        ViewBag.BasketInoperativeMsg = errorMsg;

        return View(vm);

It just returns a view but dosent specify which - am i correct by thinking it is written "under the hood" by the mapping structure? CatalogController return a view named index -> the program looks for a catalog-folder under views -> returns index view.

Attatched an image of the folder structure 🙂
Yep, exactly
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.