You can return using hardset status codes like Ok();
or BadRequest();
Or return using a dynamic one using
StatusCode(<Your status code number>,<Optional return object>);
This is using Microsoft.AspNetCore.Mvc
Below is this.StatusCode spelled out a little more:
/* "this" comes from your class being a subclass of Microsoft.AspNetCore.Mvc.ControllerBase */
StatusCodeResult scr = this.StatusCode(200);
/* OR */
Object myObject = new Object();
ObjectResult ores = this.StatusCode(200, myObject);
return scr; /* or return ores;*/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…