Created
May 22, 2018 19:34
-
-
Save khalidabuhakmeh/4403cdcf82df88b9d132c257b71457a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public controller Home { | |
| // GET home/something | |
| GET Something() { | |
| // c# code here | |
| // assumes you are returning IActionResult | |
| return Ok(); | |
| } | |
| // POST home/something | |
| POST Something(Model Model) { | |
| // c# code here | |
| // assumes you are returning IActionResult | |
| return Ok(); | |
| } | |
| // GET home/greetings | |
| async GET Greetings(HttpRequest request) { | |
| var result = await Task.FromResult(0); | |
| return Ok(result); | |
| } | |
| // POST Homes/{id} | |
| // convention dictates anything not in | |
| // a complex model is a path parameter | |
| async POST Homes(int id, HomeRequest request) { | |
| var home = db.Homes.Find(id); | |
| home.Update(request); | |
| return home; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment