public ActionResult EditUser(string id)
        {
            ApplicationUser user     = _userService.Find(id);
            var             viewUser = Mapper.Map <UpdateUserViewModel>(user);

            return(PartialView("_EditUser", viewUser));
        }
示例#2
0
        public ActionResult Index()
        {
            var id = User.Identity.GetUserId();

            var currentUser = _userService.Find(id);

            var currentUserView = Mapper.Map <UpdateUserViewModel>(currentUser);

            return(View(currentUserView));
        }
示例#3
0
        public ActionResult GetPadingRating(Guid idMovie, int?page)
        {
            int pageSize = VariableUtils.pageSize;

            int pageNumber = (page ?? 1);

            if (idMovie != null)
            {
                var listRating             = _ratingService.GetAllRatingByIdMovie(idMovie);
                var listUseRatingViewModel = new List <UseRatingViewModel>();
                foreach (var item in listRating)
                {
                    var use             = _applicationUserService.Find(item.UserId);
                    var ratingViewModel = Mapper.Map <RatingViewModel>(item);
                    listUseRatingViewModel.Add(new UseRatingViewModel()
                    {
                        RatingViewModel = ratingViewModel,
                        UseViewModel    = use
                    });
                }
                ViewBag.IdMovie = idMovie;
                return(PartialView("_PartialViewRating",
                                   listUseRatingViewModel.ToPagedList(pageNumber, pageSize)));
            }

            return(PartialView("_PartialViewRating"));
        }
        public ActionResult DeleteUser(string id)
        {
            try
            {
                var user = _applicationUserService.Find(x => x.Id.Equals(id)).Single();
                _applicationUserService.Delete(user);

                Alert("Usuário removido com sucesso!", Enum.NotificationType.success);
            }
            catch (Exception)
            {
                Alert("Ocorreu um erro! Informe o administrador do sistema.", Enum.NotificationType.error);
            }

            ModelState.Clear();
            UpdateUsers(_adminViewModel);

            return(View("User", _adminViewModel));
        }