コード例 #1
0
        //
        // GET: /Member/
        public ActionResult Index()
        {
            var dao = new CityLibraryDao();

            var users = dao.GetUsers();

            //var firstUser = users.FirstOrDefault(u => u.FirstName == "Czesław");

            // nie moze byc nulla
            //var single = users.SingleOrDefault(u => u.UserID == 1);

            //if (single != null)
            //{
            //    var email = single.Email;
            //}

            //int sss = users.Where(u => u.FirstName.ToUpper().Contains("CZE")).Sum(u => u.LastName.Length);

            var members = users
                .Select(u =>
                    new UserModel
                    {
                        UserId = u.UserID,
                        FirstName = u.FirstName,
                        LastName = u.LastName,
                        BirthDate = u.BirthDate,
                        Email = u.Email
                    }
            ).ToList();

            return View(members);
        }
コード例 #2
0
 public void GetUsersTest()
 {
     var dao = new CityLibraryDao();
     var users = dao.GetUsers();
     Assert.IsNotNull(users);
 }