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
);
??? 😀 ???
You can easily create a REST Api:
and use for example of your Workout:
But I would suggest you to use WCF though 🙂
From a client side:
remember to create a Login method that you would send a
tokenthat is required in all actions, so you know that the user manipulating your data isreal.