API Restfull C# Get Method with Stored Proc. SQL Server
Budget: $10 – $30 USD
Hi, i need a API C# "Get method" with that stored procedure, like this:
localhost:1234/api/values/GetSomeCars?listOfIDs=503,501 and then return the rows of the cars of the list...
CREATE TABLE [dbo].[tblCar](
[IDCar] [varchar](3) NULL,
[NameCar] [nchar](100) NULL,
[CompanyCar] [nchar](100) NULL
) ON [PRIMARY]
GO
--Insert rows
INSERT INTO [dbo].[tblCar]
([IDCar]
,[NameCar]
,[CompanyCar])
VALUES
(500, 'Journey', 'Dodge'),
(501, 'Model S', 'Tesla'),
(502, 'Corolla', 'Toyota'),
(503, 'X5', 'BMW'),
(504, 'C200', 'Mercedes-Benz')
GO
--Query All rows
SELECT [IDCar]
,[NameCar]
,[CompanyCar]
FROM [dbo].[tblCar]
GO
--Query some rows OK works
SELECT [IDCar]
,[NameCar]
,[CompanyCar]
FROM [dbo].[tblCar]
WHERE [IDCar] IN ('501','503')
GO
--create stored procedure
CREATE PROCEDURE [dbo].[SP_SOMECARS]
@listOfIDs varchar(200)
AS
BEGIN
SET NOCOUNT ON;
SELECT [IDCar]
,[NameCar]
,[CompanyCar]
FROM [dbo].[tblCar]
WHERE [IDCar] IN (@listOfIDs)
END
GO
--exec procedure don't work
EXEC SP_SOMECARS @listOfIDs = ('501','503')
Tks and regards.
localhost:1234/api/values/GetSomeCars?listOfIDs=503,501 and then return the rows of the cars of the list...
CREATE TABLE [dbo].[tblCar](
[IDCar] [varchar](3) NULL,
[NameCar] [nchar](100) NULL,
[CompanyCar] [nchar](100) NULL
) ON [PRIMARY]
GO
--Insert rows
INSERT INTO [dbo].[tblCar]
([IDCar]
,[NameCar]
,[CompanyCar])
VALUES
(500, 'Journey', 'Dodge'),
(501, 'Model S', 'Tesla'),
(502, 'Corolla', 'Toyota'),
(503, 'X5', 'BMW'),
(504, 'C200', 'Mercedes-Benz')
GO
--Query All rows
SELECT [IDCar]
,[NameCar]
,[CompanyCar]
FROM [dbo].[tblCar]
GO
--Query some rows OK works
SELECT [IDCar]
,[NameCar]
,[CompanyCar]
FROM [dbo].[tblCar]
WHERE [IDCar] IN ('501','503')
GO
--create stored procedure
CREATE PROCEDURE [dbo].[SP_SOMECARS]
@listOfIDs varchar(200)
AS
BEGIN
SET NOCOUNT ON;
SELECT [IDCar]
,[NameCar]
,[CompanyCar]
FROM [dbo].[tblCar]
WHERE [IDCar] IN (@listOfIDs)
END
GO
--exec procedure don't work
EXEC SP_SOMECARS @listOfIDs = ('501','503')
Tks and regards.