Пример #1
0
        public IActionResult OnGet(int id)
        {
            Account = _accountRepo.GetById(id);
            Profile = _profileRepo.GetByAccountId(id);
            if (Account == null || Profile == null)
            {
                return(NotFound());
            }

            UserRoles      = _roleRepo.GetAllFormAccountId(id);
            AvailableRoles = _roleRepo.GetAll()
                             .Except(UserRoles)
                             .Select(r => new SelectListItem(r.Name, r.Id.ToString()));

            Input = new InputModel {
                DateOfBirth   = Profile.Birthday,
                FirstName     = Profile.FirstName,
                LastName      = Profile.LastName,
                PerferredName = Profile.PreferredName,
                Phone         = Profile.Phone,
                Email         = Account.EMail,
                Status        = Account.Status
            };
            return(Page());
        }
Пример #2
0
        public IActionResult OnGetUpdateStatus(int id, bool approve)
        {
            var account = _accountRepo.GetById(id);

            //TODO: Add error message here.
            if (account == null)
            {
                return(NotFound());
            }

            account.Status = approve ? AccountStatus.Ok : AccountStatus.Disabled;
            _accountRepo.Update(account);
            return(RedirectToPage());
        }