forked from kstreith/webapi-routing-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OrderController.cs
52 lines (51 loc) · 1.33 KB
/
OrderController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace MvcApplication1.Controllers
{
public class OrderController : ApiController
{
// GET api/order
[ActionName("DefaultAction")]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/order/5
[ActionName("DefaultAction")]
public string GetDefaultAction(int id)
{
return "value";
}
// POST api/order
[ActionName("DefaultAction")]
public void Post([FromBody]string value)
{
}
// PUT api/order/5
[ActionName("DefaultAction")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/order/5
[ActionName("DefaultAction")]
public void Delete(int id)
{
}
// GET api/order/5/vendors
[HttpGet]
public IEnumerable<string> Vendors(int id)
{
//id is the order id
return new string[] { "vendor1", "vendor2" };
}
// PUT api/order/5/reject
[ActionName("Reject")]
public void PutReject(int id)
{
}
}
}