0

I have created an MVC 6 project (MVC Movies) which has SQL tables such as AspNetUsers.

I want to be able to display a list of Users who are on the AspNetUsers table so for that I have a Model 'AspNetUsers':

public class AspNetUsers
{
    public int ID { get; set; }
    public string Email { get; set; }
}

I also then have another class 'AspNetUserInfo' which holds a List of AspNetUsers:

public class AspNetUserInfo
{
    public List<AspNetUsers> MyUserList { get; set; }
}

To show this list I then need a Controller with Views, and this is where my issue Starts: Everytime I try to create Views I am met with this:

enter image description here

I can create a Controller (without views) and I have done:

    public IActionResult Index()
    {
        AspNetUserInfo userInfo = new Models.AspNetUserInfo();
        List<AspNetUsers> aspUsers = userInfo.MyUserList.ToList();
        return View(aspUsers);
    }

I cannot create a Controller with views nor can I create views for this controller without seeing the error above. I think that I need to add a Parameterless Constructor in my ApplicationDbContext but I am unsure how to do this.

Thanks in advance for any help.

James Tordoff
  • 661
  • 1
  • 5
  • 25

0 Answers0