Git Product home page Git Product logo

Comments (6)

ardalis avatar ardalis commented on August 16, 2024 1

This is supported in 4.x release, I believe. We now have native ActionResult and ActionResult options with the fluent generic base class, as well as ability to just use the base class directly with whatever signature you want.

from apiendpoints.

maxkoshevoi avatar maxkoshevoi commented on August 16, 2024

You can use WithoutResponse for this (misleading name in this case, but it will work).
This will create a Task<ActionResult> method that is able to return CreatedAtRoute.

PS: I think, WithoutResponse should really be named WithActionResponse (or WithActionResult), and WithoutResponse should result in Task method (without type argument).

from apiendpoints.

pdevito3 avatar pdevito3 commented on August 16, 2024

Haven't tried this yet, but even if that does work, how do you resolve the route argument to point to the get route for getting the data from the POST (i.e. GetPatient)?

from apiendpoints.

maxkoshevoi avatar maxkoshevoi commented on August 16, 2024

Didn't quite understand you there, but

return CreatedAtRoute("GetPatient",
	  new { commandResponse.PatientId },
	  response);

will work, if that's what you asking.

from apiendpoints.

pdevito3 avatar pdevito3 commented on August 16, 2024

Didn't quite understand you there, but

return CreatedAtRoute("GetPatient",

	  new { commandResponse.PatientId },

	  response);

will work, if that's what you asking.

This was more of a follow up.

I don't have a chance to try it right now, but last I remember it didn't work because it doesn't know where GetPatient is and I still don't see how it could know, unless ApiEndpoint has some key mapping under the hood across all routes. The only way this currently works to my knowledge is if is this POST is in the same controller as GetPatient

from apiendpoints.

maxkoshevoi avatar maxkoshevoi commented on August 16, 2024

Can you show how GetPatient controller/action looks? More specifically, what is the route to it and what arguments it accepts.

from apiendpoints.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.