Q:

Cannot convert String Type 'String' to 'MVCTutorial.Model.tblDept'

I'm trying to show list of employees to view by following code. I have tblemployee class and tblDept class. 
EmployeeViewModel EmployeeVM = new EmployeeViewModel();
MvcEmployeeEntities db = new MvcEmployeeEntities();
List<TblEmployee> emplist = db.TblEmployees.ToList();

        List<EmployeeViewModel> EmpVMlist = emplist.Select(
            x => new EmployeeViewModel { 
                Emp_ID = x.Emp_ID, 
                Emp_Name = x.Emp_Name, 
                Emp_Number = x.Emp_Number, 
                DeptID = x.DeptID, 
              **DeptName = x.tblDept.DeptName** }).ToList();

Return(EmpVMlist);

at this point deptName shows error saying String can't be implicitly converted to NamespaceModel Class. 
Is they any way to implicitly convert it ? 
Note I have a Public virtual tblDept  deptName {get;set;} as it is driven from tbldept.class
public class EmployeeViewModel
{
    public int Emp_ID { get; set; }
    public string Emp_Name { get; set; }
    public Nullable<int> Emp_Number { get; set; }
    public Nullable<int> DeptID { get; set; }
    //virtual to use an other tble with in this tble, to get set there tblValues
    public virtual tblDept DeptName { get; set; }
}

A:

The error is self explanatory.x.tblDept.DeptName in your LINQ Select expression will read the DeptName property value of the associated Department of the Employee record you are reading, but you are trying to set the property value to DeptName property which is of type tblDept! So basically you are trying to assign apple type to orange!
Ideally, your view model should not be using your entity classes. View models are models specific to a view. Keep it simple and lean. Most of the time simple-lean-flat view models are what you need.
So change your DeptName property in your view model to string.
public class EmployeeViewModel
{
    public int Emp_ID { get; set; }
    public string Emp_Name { get; set; }
    public int? Emp_Number { get; set; }
    public int? DeptID { get; set; }
    public string DeptName { get; set; }
}

Keep only those properties you absolutely need in the view, in your view model. No need to copy the entire entity class structure. 

