public async Task <LibraryUserViewModel> CurrentLogonUserAsync()
        {
            var userName = User.Identity.Name;

            var userBuilder = new LibraryUserModelBuilder();
            var user        = await userBuilder.BuildModelFromAsync(userName);

            return(user);
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Lock(int id)
        {
            if (id > 0)
            {
                var user = await UserManager.FindByIdAsync(id);

                if (user == null)
                {
                    return(HttpNotFound());
                }

                var userBuilder = new LibraryUserModelBuilder();
                var userModel   = await userBuilder.BuildModelFromAsync(user.UserName);

                ViewBag.HasUnreturnedBooks = userModel.RentBooks != null && userModel.RentBooks.Count > 0;

                return(View(user));
            }
            return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
        }