Click here to Skip to main content
14,387,650 members
Rate this:
Please Sign up or sign in to vote.
See more:
I used this tutorial to start with core 2.2 Tutorial: Create a web API with ASP.NET Core MVC | Microsoft Docs[^], filed off the serial numbers and changed the colour but the same style.

All went well until I wanted to get a filtered selection so I need a second (and third) GET. Using Postman I get a duplicate GET error with

There is no routing in the Startup.cs

What I have tried:

Controller starts with
public class UserDetailsController : ControllerBase
		DAL.UserDetails dsUserDetails = new UserDetails();

		public ActionResult<IEnumerable<UserDetailsDB>> GetUsers()
			IEnumerable<UserDetailsDB> lResult = dsUserDetails.UserDetailsList();
			return lResult.ToList();

Second GET with additional filter - what is the decoration for this or the calling syntax for the GET
public ActionResult<IEnumerable<UserDetailsDB>> GetUserForFleet([FromQuery] int FleetID)
  IEnumerable<UserDetailsDB> lResult = dsUserDetails.UserDetailsForFleet(FleetID);
  return lResult.ToList();
Updated 7-Mar-19 21:46pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Put the route name in the decorator:


So you can call:

Mycroft Holmes 8-Mar-19 17:13pm
Thanks - the last hurdle to getting my POC ready except I need to secure the API now [chuckle]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100