c# - How to return list of Stored Procedure in SQL Server and WebAPI2 -


the following code contains created procedure.

use [sample_db] go set ansi_nulls on go set quoted_identifier on go  create procedure [dbo].[getallgroups]  begin     select [dbo].[qr_groups].[id], [dbo].[qr_groups].[name], [dbo].[qr_groups].[code]     [dbo].[qr_groups] end 

i can't use stored procedure because i'm getting error message:

cannot implicitly convert type 'int' 'system.linq.iqueryable'

i don't know how return data table in webapi.

here controller code:

public iqueryable<qr_group> getallgroups() {     return db.getallgroups(); } 

edit:

new error message:

cannot implicitly convert type 'system.data.entity.core.objects.objectresult‌​' 'system.linq.iqueryable'. explicit conversion exists (are missing cast?)

i have never used stored procedures in ef think want this

public ilist<qr_group> getallgroups() {     return db.getallgroups().tolist(); } 

Comments