static void Main(string[] args) { var userApp = new UserApp(); userApp.Add(new User { Login = "******", Password = "******" }); userApp.Add(new User { Login = "******", Password = "******" }); userApp.Add(new User { Login = "******", Password = "******" }); var users = userApp.GetAll(); foreach (var item in users) { Console.WriteLine($"Login: {item.Id}-{item.Login}"); } Console.ReadLine(); }
public void AddUser() { var p = new User() { LoginName = "YuchenghaoList12344", Gender = Gender.Male, LoginPwd = "213", userTypes = new List <UserType>() }; for (int i = 1; i < 3; i++) { var k = new UserType() { TypeCont = i.ToString(), TypeName = "工作人员" }; p.userTypes.Add(k); } UserApp areaApp = new UserApp(); areaApp.Add(p); }