public IActionResult SetPassword(string id)
 {
     var model = new SetPasswordViewModel { ClassRoom = id };
     return View(model);
 }
        public async Task<IActionResult> SetPassword(SetPasswordViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            var user = await GetCurrentUserAsync();
            if (user != null)
            {
                var result = await _userManager.AddPasswordAsync(user, model.NewPassword);
                if (result.Succeeded)
                {
                    await _signInManager.SignInAsync(user, isPersistent: false);
                    if (string.IsNullOrEmpty(model.ClassRoom)) return RedirectToAction(nameof(Index), new { Message = ManageMessageId.SetPasswordSuccess });
                    else
                    {
                        var redirectURL = $"/my#!/app/course/{ model.ClassRoom }/setting";
                        return Redirect(redirectURL);
                    }
                }
                AddErrors(result);
                return View(model);
            }
            return RedirectToAction(nameof(Index), new { Message = ManageMessageId.Error });
        }
        public async Task<IActionResult> SetPassword(SetPasswordViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            var user = await GetCurrentUserAsync();
            var redirectURL = string.Format("/My#/app/course/{0}/setting", model.ClassRoom);
            if (user != null)
            {
                var result = await _userManager.AddPasswordAsync(user, model.NewPassword);
                if (result.Succeeded)
                {
                    await _signInManager.SignInAsync(user, isPersistent: false);
                    return Redirect(redirectURL);
                }
                AddErrors(result);
                return View(model);
            }
            return Redirect(redirectURL);
        }