Here i am using MVC4 razor and stored procedure.Here i am trying to retrieve userid and usertype from sp (retrieving as a objec) ,but i am getting null value for tabledata variable .How could i get userid and usertype for that particular username and password,please help me i am new to MVC
Homecontroller.cs
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(logintable p)
{
OnlineAppraisalEntities db = new OnlineAppraisalEntities();
logintable tabledata = new logintable();
tabledata = db.sp_Userlogindata(p.Username, p.Password);
return View(p);
}
Stored procedure
ALTER PROCEDURE [dbo].[sp_Userlogindata]
-- Add the parameters for the stored procedure here
@Username varchar(30),
@Password varchar(30)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
select Usertype,UserID from logintable where Username=@Username and Password=@Password
END