79411770

Date: 2025-02-04 13:00:39
Score: 0.5
Natty:
Report link

So I (and GPT) wrote a model binder that able to do it, but for one model (like [FromBody]). not for two or more fields.

example of usage:

[HttpPost]
 public IActionResult PostData([FormOrJson] ModelType model) {
  if (!ModelState.IsValid) {
    return BadRequest(ModelState);
  }
  // Process the model...

  return Ok(new { model });
}

https://gist.github.com/MosheL/bd9edf2b2db0f7eb0ae554e482f28e7c

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: Moshe L