コード例 #1
0
        static HomeController()
        {
            // Create a few unique users.
            var jobIndex = 0;
            var pastJobCount = 0;
            for (var i = 0; i < 10; i++)
            {
                var user = new User
                {
                    CurrentJob = BigViews.User.AvailableJobs[jobIndex],
                    FirstName = $"Joey { i }",
                    LastName = "Brown",
                    HomePhone = $"425-555-{ i }{ i }{ i }{ i }",
                    Mobile = $"206-555-{ i }{ i }{ i }{ i }",
                    MailId = $"Joey{ i }@contoso.com",
                };
                jobIndex = (jobIndex + 1) % BigViews.User.AvailableJobs.Count;

                for (var j = 0; j < pastJobCount; j++)
                {
                    user.PastJobs.Add(BigViews.User.AvailableJobs[jobIndex]);
                    jobIndex = (jobIndex + 1) % BigViews.User.AvailableJobs.Count;
                }

                pastJobCount = (pastJobCount + 1) % 3;
                _users.Add(user.MailId, user);
            }
        }
コード例 #2
0
 public IActionResult Edit(User user)
 {
     var result = new ContentResult();
     result.Content = user.FirstName;
     return result;
 }