[Tizen] Add BuildTools 2.1.0-rc1-02804-05
[platform/upstream/coreclr.git] / Tools / dotnetcli / sdk / NuGetFallbackFolder / microsoft.visualstudio.web.codegenerators.mvc / 2.0.1 / Templates / ControllerGenerator / ApiControllerWIthActions.cshtml
1 @inherits Microsoft.VisualStudio.Web.CodeGeneration.Templating.RazorTemplateBase
2 using System;
3 using System.Collections.Generic;
4 using System.Linq;
5 using System.Threading.Tasks;
6 using Microsoft.AspNetCore.Http;
7 using Microsoft.AspNetCore.Mvc;
8
9 @{string modelName = (Model.ClassName.EndsWith("Controller") ? Model.ClassName.Substring(0, Model.ClassName.Length - 10) : Model.ClassName);}
10 namespace @Model.NamespaceName
11 {
12 @{
13     string routePrefix = "api/" + modelName;
14 }
15     [Produces("application/json")]
16     [Route("@routePrefix")]
17     public class @Model.ClassName : Controller
18     {
19         // GET: api/@modelName
20         [HttpGet]
21         public IEnumerable<string> Get()
22         {
23             return new string[] { "value1", "value2" };
24         }
25
26         // GET: api/@modelName/5
27         [HttpGet("{id}", Name = "Get")]
28         public string Get(int id)
29         {
30             return "value";
31         }
32         
33         // POST: api/@modelName
34         [HttpPost]
35         public void Post([FromBody]string value)
36         {
37         }
38         
39         // PUT: api/@modelName/5
40         [HttpPut("{id}")]
41         public void Put(int id, [FromBody]string value)
42         {
43         }
44         
45         // DELETE: api/ApiWithActions/5
46         [HttpDelete("{id}")]
47         public void Delete(int id)
48         {
49         }
50     }
51 }