Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6358375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:21:44+00:00 2026-05-24T23:21:44+00:00

Do i have to list all controller functions in Global.asax.cs file? Im creating a

  • 0

Do i have to list all controller functions in Global.asax.cs file?

Im creating a api for my workout and have created the controller WorkoutController. It has the action AddWorkout that takes some parameters, for instance username, password, duration and type. Two first are string, two last is ints.

Now, do i need to create a route for it? And every action with different action signature? Why could it not fall in under the default route? Calling it would break if i dont supply the correct variables, but i know what im doing 😀

routes.MapRoute(
                "AddWorkout", // Route name
                "Workout/AddWorkout/", // URL with parameters
                new { controller = "Workout", action = "AddWorkout" } // Parameter defaults
            );

??? 😀 ???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:21:45+00:00Added an answer on May 24, 2026 at 11:21 pm

    You can easily create a REST Api:

    routes.MapRoute(
        "Workout", // Route name
        "{controller}/{action}", // URL with parameters
        new { controller = "Home", action = "Index" } // Parameter defaults
    );
    

    and use for example of your Workout:

    public class WorkoutController : Controller
    {
        public ActionResult Index()
        {
            return RedirectToAction("Index", "Help");
        }
    
        [HttpPost]
        public ActionResult Workout(FormCollection form)
        {
            // HTTP POST: ADD Workout
    
            // process form and return JSON
            return Json(myObject);
        }
    
        [HttpDelete]
        public ActionResult Workout(string id)
        {
            // HTTP DELETE: REMOVE Workout
    
            // process form and return JSON
            return Json(myObject);
        }
    
        [HttpGet]
        public ActionResult Workout(string id)
        {
            // HTTP GET: GET Workout
    
            // process form and return JSON
            return Json(myObject);
        }
    }
    

    But I would suggest you to use WCF though 🙂

    From a client side:

    $.ajax({
       type: "POST",
       url: "/Workout/Workout",
       data: { 
               'type': '123456', 
               'height': '171'
             }
       success: function(msg){
         alert( "Data Saved: " + msg );
       }
     });
    
    
    $.ajax({
       type: "DELETE",
       url: "/Workout/Workout",
       data: { 'id': '123456' }
       success: function(msg){
         alert( "Data Saved: " + msg );
       }
     });
    
    
    $.get("/Workout/Workout", { 'id': '123456' }, function(msg){
         alert( "Data Saved: " + msg );
       });
    

    remember to create a Login method that you would send a token that is required in all actions, so you know that the user manipulating your data is real.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have PostsController controller and in this controller i need get all user list.
If I have List<String> text how can I create a sub-list of all continious
Say I have a list of all Projects , and that I group them
I would like to have a list of all the time zones available on
Is there any way to list all the files that have changed between two
I need to have a query which list all the user according to the
I have an object, and I want to list all the selectors to which
I have a list of 400 strings that all end in _GONOGO or _ALLOC.
I have a list of calling codes for all countries(the phone number prefixes), I
I have a list of booleans where occasionally I reset them all to false.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.