Dear Mr,
In case I need to use a stored procedure from DB in sql server and this stored procedure has many parameters and many join to many tables and return many fields from many table how to call and use it with WEB API Controller?
Many thanks and best regards,
Example : EF
public virtual DbSet T_Clubs { get; set; }
public virtual DbSet T_Games { get; set; }
public virtual DbSet T_Reservations { get; set; }
//HOW TO USE THIS WITH WEB API Controller this a stored procedure in DB ?!! PLease advice
public virtual int GetReservationsByClubId(Nullable clubId)
{
var clubIdParameter = clubId.HasValue ?
new ObjectParameter("ClubId", clubId) :
new ObjectParameter("ClubId", typeof(int));
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetReservationsByClubId", clubIdParameter);
}
//HOW TO USE THIS WITH WEB API Controller this a stored procedure in DB ?!! PLease advice
public virtual ObjectResult GetReservations()
{
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetReservations");
}
//HOW TO USE THIS WITH WEB API Controller this a stored procedure in DB ?!! PLease advice?
Thank you and best regards
Mukesh NayakPosted Jan 28, 2018, 3:33 AM