public IActionResult Get(int id) { var result = MyDemoEntityBusiness.Get(id); if (result == null) { // this will return a HTTP Status Code 404 (Not Found) along with the message return(HttpNotFound($"No example found with id = {id}")); } else { // this will return a HTTP Status Code 200 (OK) along with the data return(Ok(result)); } }
public IActionResult Delete([FromBody] int id) { MyDemoEntityBusiness.Delete(id); return(Ok()); //Return code is not ok, but you get the point... }
public async Task <IActionResult> UpdateAsync(int id, [FromBody] MyDemoEntity model) { await MyDemoEntityBusiness.SaveAsync(model); return(Ok()); }
public IActionResult Save([FromBody] MyDemoEntity myentity) { return(Ok(MyDemoEntityBusiness.Save(myentity))); //Return code is not ok, but you get the point... }
public IActionResult GetAll() { // this will return a HTTP Status Code 200 (OK) along with the data return(Ok(MyDemoEntityBusiness.GetAll())); }