コード例 #1
0
        public async Task <ActionResult> Index(string partialViewName = "ViewAccountPartial")
        {
            // Get authenticated user's username.
            var userName = User.Identity.Name;

            // Find authorised user details in database.
            var user = await _dataAccess.FindByNameAsync(userName);

            // Find bookings for authorised user.
            var bookings = await _bookingManager.FindBookingsByUserAsync(user);

            AccountDetailsModel model = new AccountDetailsModel
            {
                AccountDetails  = user.ToApplicationUser(),
                Bookings        = bookings,
                PartialViewName = partialViewName
            };

            return(View(model));
        }