public IActionResult Post([FromBody] StwStoreModel stwStoreModel) { try { if (!IsAuthorized()) { return(Unauthorized()); } if (!ModelState.IsValid) { IEnumerable <ModelError> allErrors = ModelState.Values.SelectMany(v => v.Errors); return(Content(JsonConvert.SerializeObject(allErrors))); // return StatusCode(406);//not acceptable } if (stwStoreModel == null) { return(NotFound()); } var stream = imgProcq.Draw_StwStore2(stwStoreModel); return(File(stream, "image/png")); } catch (Exception e) { return(Content(JsonConvert.SerializeObject(e))); } }