Hi before I use to retrieve and manipulate data directly from my DB..but this time I am using Entity Data Model.. I have all the tables in my .edmx file .... I have some queries in my DB for retrieving data but now as I am using Entity Data Model I don't know how to call that procedure in my controller as I am using MVC 3 here can any one tell me how to get the data using my stored procedure or write a Linq query similar to my stored procedure in my controller
Here is my stored procedure:
ALTER procedure [dbo].[ProjectReports]
(
@ProjectID int,
@ReleasePhaseID int
)
as
begin
select distinct projectName,ReleasePhase,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='New')) as Newbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Assigned')) as
Assignedbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Fixed')) as Fixedbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Re-Opened')) as
Reopenedbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Closed')) as Closedbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Deffered')) as Defferedbugs,
(Select COUNT(1) from Bugs where ProjectId=a.ProjectId and
ReleasePhaseID=a.ReleasePhaseID and
bugid in (select BugID from BugHistory where [status]='Not a Bug')) as NotaBug
from Bugs a
inner join Projects p on p.ProjectId=a.ProjectId
inner join ReleasePhase Rp on rp.ReleasePhaseID=a.ReleasePhaseID
where a.ProjectId=@ProjectID and a.ReleasePhaseID=@ReleasePhaseID
end
How do I do this?