Is it possible to return custom table from SP . I'm using EF code first approach.
This is my SP
CREATE PROCEDURE [dbo].[GetUserNotification]
@ToUserId INT
AS
BEGIN
select TU.FullName as ToUserName,
FU.FullName as FromUserName,
N.NotificationClickType,
N.TemplateId,
J.Title as JobTitle,
J.Identifier as JobIdentifier,
B.Identifier as BidIdentifier
from Notification N
inner Join AppUser TU on TU.Identifier = N.ToUserId
inner Join AppUser FU on FU.Identifier = N.FromuserId
inner Join Bid B on B.Identifier = N.NotificationBidId
inner Join Job J on J.Identifier = B.JobId
where N.ToUserId=@ToUserId
Order By N.Identifier DESC
END
my Custom View Model
public class NotificationModel
{
public string ToUserName { get; set; }
public string FromUserName { get; set; }
public NotificationClickType NotificationClickType { get; set; }
public int TemplateId { get; set; }
public string JobTitle { get; set; }
public int JobIdentifier { get; set; }
public int BidIdentifier { get; set; }
}
I have created same ViewModel. But every where I have seen Using SP i can return Only single table data which I have added in my DbContext class.