San

San

  • 877
  • 804
  • 314.3k

Stored Procedure Call in Web API using DBContext.

Mar 5 2019 10:54 AM
Please check the below code it is working fine but i want the without model name Account .
 
In Procedure join the tables but usig _DBcontext.Account. then display only Account
table column.
 
[HttpGet("GetAccount")]
public async Task GetAccount(int accountid)
{
SqlParameter adAccount = new SqlParameter("@AccountID", accountid);
var query = _DBcontext.Account.FromSql(@"EXECUTE [dbo].[sp_GetAccount] @ID", Accountad);
var list = query.ToList();
return Json(list);
}

Answers (2)