I've been looking for answers for the past days and still I haven't got any idea on how can I make my app work. I only have one controller for all the subtabs of my app. I had one http get method for one subtab under the main controller and I need another http get method for another subtab to also be under the main controller. How can I possibly do that?
Asked
Active
Viewed 60 times
-1
-
can you send your code what you done ? – Vipin Jain Jan 09 '16 at 05:51
-
you can call multiple get method in one controller and assign to variables – Vipin Jain Jan 09 '16 at 06:11
-
@VipinJain how?if it is not too much, can you show me in plunker?thanks – bleyk Jan 09 '16 at 06:15
-
yes i show but your code there are no tab or subtab. you only create a controller and inside you call a get method thats it – Vipin Jain Jan 09 '16 at 06:17
-
can you show me how can I assign http get method into variables? @VipinJain – bleyk Jan 09 '16 at 06:20
-
you can assign in variable but you say 'I need another http get method for another subtab to also be under the main controller' so you can call one other http get method and asign to a variable like you done in example `var json = $.xml2json(data);` – Vipin Jain Jan 09 '16 at 06:25
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/100210/discussion-between-bleykfaust-and-vipin-jain). – bleyk Jan 09 '16 at 06:31
1 Answers
0
You can use attribute routing.
[HttpGet]
[Route("method1/{id}")]
public HttpResponseMessage index(string id)
{
try
{
// your code
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.Forbidden,ex.Message);
}
}
[HttpGet]
[Route("method2/{Id}")]
public HttpResponseMessage GetData(string GetRecordsById)
{
try
{
//your code
}
catch (Exception)
{
throw;
}
}

Mahavir Kumbharvadia
- 98
- 2
- 13