forked from aspnet/JavaScriptServices
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPeopleApiController.cs
More file actions
30 lines (27 loc) · 826 Bytes
/
Copy pathPeopleApiController.cs
File metadata and controls
30 lines (27 loc) · 826 Bytes
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
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace ReactExample.Controllers
{
public class PeopleApiController : Controller
{
[HttpPut("api/people/{personId:int}")]
public ActionResult UpdatePerson([FromBody] PersonDto person)
{
if (!ModelState.IsValid) {
return BadRequest(ModelState);
} else {
return new OkResult();
}
}
}
public class PersonDto {
public string name { get; set; }
public string city { get; set; }
public string state { get; set; }
public string country { get; set; }
public string company { get; set; }
[Range(1, 10)]
public int favoriteNumber { get; set; }
}
}