Calling a different action method for the same URL

Calling a different action method for the same URL

Scenario is something like this:

Scenario is something like this:

I have a website where users can create their own stores. Upon creation, they have an option to choose a store template. Right now, whatever template you choose, when you go to a URL (lets say /home), it calls the same action method and then does a call to BLL from that action method.

Now, I want to retrieve data using ASP.NET Web API instead of directly from MVC Controllers but I want it only for 1 particular template. It still needs to have the same URL for /home as the other templates even though its retrieval is different now.

I wanted to ask if there is a way that I have a global flag that I can turn on (eg. APIEnabled) and then based on that flag, use a different action method from the same GET request.

I understand that with this flag I can just do a condition inside the action method but I feel it will make my Action methods messy.

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Calling a different action method for the same URL

Scenario is something like this:

URIs, URLs, and URNs | Difference between URI and URL | URL Explained

In this video lesson, I define The URI, the URL, and the URN, I explain what are they, the difference between them and I talk about URLs in more details.

JavaScript tutorial - call, apply and bind methods in JavaScript

This tutorial covers call(), apply() and bind() methods. A multiple basic examples have been provided. Working with JavaScript “this” keyword can be tricky. Not knowing the background rules may end up with the famous “it works, but I don’t know why” or worse: “it doesn’t work and I don’t know why”. It’s good to know the theory before putting things into practice. Call(), Apply() and Bind() methods can come in handy when setting the “this” value.

How to call a non-void method from a void method?

Is it possible to call an int method which receives an object and returns an int value from a void method by sending a temporary object to it?

Chaining method calls in JavaScript

In JavaScript sometimes we can chain method calls. It’s important to note that you can’t use arrow functions, because this in an arrow function used as object method is not bound to the object instance. I like to use arrow functions all the time, and this is one of the cases where you can’t.