コード例 #1
0
        public async Task <IActionResult> Edit(AdminUserStatusEditViewModel viewModel)
        {
            UserStatus userStatus = await userStatusService.GetByIDAsync(viewModel.ID);

            if (userStatus == null)
            {
                return(NotFound());
            }

            userStatus.Id   = viewModel.ID;
            userStatus.Name = viewModel.Name;

            userStatusService.Update(userStatus);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            UserStatus userStatus = await userStatusService.GetByIDAsync((int)id);

            if (userStatus == null)
            {
                return(NotFound());
            }

            AdminUserStatusEditViewModel viewModel = new AdminUserStatusEditViewModel
            {
                ID   = userStatus.Id,
                Name = userStatus.Name
            };

            return(View(viewModel));
        }