I have a viewmodel as such:
namespace Lipton.Areas.Drugs.Models
{
public class DrugViewModel
{
public string ID { get; set; }
public IEnumerable<tblDrug> DrugList { get; set; }
}
}
The above works fine. The reason why it works is because for tblDrug is in the appropriate namespace:
Lipton.Areas.Drugs.Models. What happens though if I need to add an IEnumerable for another table – tblEmp which is in a totally different namespace (Lipton.Areas.Empl.Models:
namespace Lipton.Areas.Drugs.Models
{
public class DrugViewModel
{
public string ID { get; set; }
public IEnumerable<tblDrug> DrugList { get; set; }
public IEnumerable<tblEmp> EmpList { get; set; }
}
}
How would I modify the above code to work due to the namespace issue?
You add a
usingdirective in order to bring the namespace into scope so that you could directly use the types declared in this namespace without fully qualifying them:I don’t even know why this question is tagged with asp.net-mvc. That’s basic c#.