From f4f3aeb13d44d3911a16bb23410901f5f8dd5c5e Mon Sep 17 00:00:00 2001 From: bicijinlian Date: Sun, 9 Jun 2019 06:38:08 +0800 Subject: [PATCH] update --- xUnitStudy.WebApi/Controllers/ValuesController.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xUnitStudy.WebApi/Controllers/ValuesController.cs b/xUnitStudy.WebApi/Controllers/ValuesController.cs index be52895..118366c 100644 --- a/xUnitStudy.WebApi/Controllers/ValuesController.cs +++ b/xUnitStudy.WebApi/Controllers/ValuesController.cs @@ -18,15 +18,23 @@ namespace xUnitStudy.WebApi.Controllers return new string[] { "value1", "value2" }; } - // GET api/values/5 + [System.Web.Http.Authorize] public string Get(int id) { return id.ToString(); } // POST api/values - public void Post([FromBody]string value) + public IHttpActionResult Post([FromBody]string value) { + var cc = new System.Web.Http.Results.CreatedAtRouteNegotiatedContentResult + ( + "", + new Dictionary { { "id",2} }, + "", + this + ); + return cc; } // PUT api/values/5