<code>using System;
using System.Linq;
using Dblayer;
using System.Collections.Generic;
using PizzaResturantDrink.Models;
namespace PizzaRestaurantDrink.Models
{
public class CRU_UserTypeMV
{
public CRU_UserTypeMV()
{
List_UserTypes = new List<UserTypeMV>();
foreach (var usertype in new PizzResturentAndDrinkDbEntities().UserTypeTBL.ToList())
{
List_UserTypes.Add(new UserTypeMV()
{
UserTypeID = usertype.UserTypeID,
UserType = usertype.UserType
});
}
}
</code>
<code>using System;
using System.Linq;
using Dblayer;
using System.Collections.Generic;
using PizzaResturantDrink.Models;
namespace PizzaRestaurantDrink.Models
{
public class CRU_UserTypeMV
{
public CRU_UserTypeMV()
{
List_UserTypes = new List<UserTypeMV>();
foreach (var usertype in new PizzResturentAndDrinkDbEntities().UserTypeTBL.ToList())
{
List_UserTypes.Add(new UserTypeMV()
{
UserTypeID = usertype.UserTypeID,
UserType = usertype.UserType
});
}
}
</code>
using System;
using System.Linq;
using Dblayer;
using System.Collections.Generic;
using PizzaResturantDrink.Models;
namespace PizzaRestaurantDrink.Models
{
public class CRU_UserTypeMV
{
public CRU_UserTypeMV()
{
List_UserTypes = new List<UserTypeMV>();
foreach (var usertype in new PizzResturentAndDrinkDbEntities().UserTypeTBL.ToList())
{
List_UserTypes.Add(new UserTypeMV()
{
UserTypeID = usertype.UserTypeID,
UserType = usertype.UserType
});
}
}
I’m using Visual Studio 2019 .Net Framework 4.7.2 I’m newbe on this and I folow a guide on Youtube.
The problem is .ToList.
When I type .UserTypeTBL.ToList isnt an option and I can’t understand why.
I have seen others that have strugle with the same error and the solution has been to add using System.Linq;. But I have allready added it.
Hope someone can give me some advice
Thanks
Erik
New contributor
Erik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.