Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

asp.net core multiple get methods

[Route("api/[controller]")]
public class IssuesController : Controller
{
    // GET: api/Issues
    [HttpGet]
    public IEnumerable<string> Get()
    {
        return new string[] { "item 1", "item 2" };
    }

    // GET api/Issues/5
    [HttpGet("{id}")]
    public string Get(int id)
    {
        return "request for "+ id;
    }

    // GET api/Issues/special/5
    [HttpGet("special/{id}")]
    public string GetSpecial(int id)
    {
        return "special request for "+id;
    }
    // GET another/5
    [HttpGet("~/another/{id}")]
    public string AnotherOne(int id)
    {
        return "request for AnotherOne method with id:" + id;
    }
    // GET api/special2/5
    [HttpGet()]
    [Route("~/api/special2/{id}")]
    public string GetSpecial2(int id)
    {
        return "request for GetSpecial2 method with id:" + id;
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity how to convert to byte 
Csharp :: unity get all by tag 
Csharp :: c# remove crlf from string 
Csharp :: How to read SQL Server COUNT from SqlDataReader 
Csharp :: how to stop window from terminating c# visual studio 
Csharp :: how t remove a component in unity 
Csharp :: Character Controller unity isGrounded is false 
Csharp :: unity reload scene 
Csharp :: c# string to memorystream 
Csharp :: json ignore property c# 
Csharp :: c# get current date without time 
Csharp :: c# linq extension methods left join 
Csharp :: get application path c# 
Csharp :: c# open file dialog 
Csharp :: get string last character vb.net 
Csharp :: unity why is there no transform.left 
Csharp :: c# int input 
Csharp :: c# base64 decode 
Csharp :: how to create directory folder in c# 
Csharp :: byte array to hex c# 
Csharp :: c# reverse string 
Csharp :: c# form formborderstyle none move 
Csharp :: move towards target unity 
Csharp :: require admin pervillages c# 
Csharp :: c# application hangs while running 
Csharp :: contains with ignore case c# 
Csharp :: read configuration workerservice 
Csharp :: c# write text before user input 
Csharp :: tooltip button winform 
Csharp :: make mesh follow wheel collider unity 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =