i am using stored procedure with mvc4 razor ,to get two values ,i have used below code to get userid and user type.Now how could i make it to return both userid and usertype from stored procedure

logintable.cs

   public partial class Userlogintable
   {
  public int UserID { get; set; }
    public string Usertypename { get; set; }
    public int Usertype { get; set; }
    public string FullName { get; set; }
    public string Username { get; set; }
    public string Password { get; set; }
   }

homecontroller .cs

 [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public ActionResult Login(logintable u)
    {
        loginEntitiesdb = new loginEntities();
        int a = db.splogindata(u.Username, u.Password).First().Value;
 //a returns only usertype
        return View(p);
    }

storeprocedure

ALTER PROCEDURE [dbo].[splogindata]
-- Add the parameters for the stored procedure here
@Username varchar(30),
@Password varchar(30)
AS
declare @Userroletype int
BEGIN

SET NOCOUNT ON;
select fullname, userid, usertype from logintable where Username=@Username   and Password=@Password

END

Here a returns only usertype which i get from sp.and logintable contains fullname,userid,usertype,password and username columns.

How could i get usertype and userid from table so that values can be stored in parameters and used to pass it to other function.

Related posts

Recent Viewed