MVC entity
1》MVC entity
1)Employee
public string Id{get;private set;}
public string Name{get;private set;}
public Employee(string id,string name)
{
this.Id=id; this.Name=name;
}
2)EmployeeRepository
private static Ilist<Employee> employees;
status EmployeeRepository() { employees =new List<Employee>(); employees.add(new Employee("001","zhangsan")); employees.add(new Employee("002","zhangsan2")); }
public IEnumerable<Employee> GetEmployees(string id) { if(string.IsNullOrEmpty(id) { return employees; } return employees.where(s=>s.id==id).ToArray(); }