Shibly  Sadik

Shibly Sadik

  • NA
  • 167
  • 139k

Retrieve specific record from database in MVC

Jul 8 2015 11:15 AM
Please look at my sample code below:

public class LoginModel
{
[Key]
public int LoginId { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
}
public class RegisterModel
{
[Key]
public int RegisterId { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string Email { get; set; }
}

public class Cart
{
[Key]
public int RecordId { get; set; }
public string CartId { get; set; }
public int ProductId { get; set; }
public int Count { get; set; }

}

There are many records in the cart table added by many users.
But i want to show the own record of a user from the cart table if he is logged in..how can I do this??

Answers (1)