public IActionResult Index() { MembersIndexVM member = new MembersIndexVM { UserName = User.Identity.Name }; return(View(member)); }
public async Task <IActionResult> Index(MembersIndexVM membersIndexVM) { if (!ModelState.IsValid) { return(View(membersIndexVM)); } var isLoggedIn = await membersService.SignInAsync(membersIndexVM); if (!isLoggedIn) { return(View(membersIndexVM)); } return(RedirectToAction("Map", "Receivers")); }
public MembersIndexVM GetMembersIndexVMById(string id, string userName) { MembersIndexVM membersIndexVM; var latestProgress = Progress .Include(p => p.Question) .Include(p => p.Question.QuizUnit) .Include(p => p.Question.QuizUnit.Category) .OrderByDescending(p => p.DateCreated) .FirstOrDefault(m => m.MemberId == id); if (latestProgress == null) { // Användaren har inte klarat av någon fråga än: membersIndexVM = new MembersIndexVM { HasPreviousProgress = false, UserName = userName, }; } else { // Läs in tidigare progress string categoryTitle = latestProgress.Question.QuizUnit.Category.Title; string quizUnitTitle = latestProgress.Question.QuizUnit.InfoTextHeader; string questionTitle = latestProgress.Question.QuestionText; int questionId = latestProgress.Question.QuestionId; membersIndexVM = new MembersIndexVM { HasPreviousProgress = true, CategoryName = categoryTitle, QuestionText = questionTitle, QuestionID = questionId, QuizUnitName = quizUnitTitle, UserName = userName, }; } return(membersIndexVM); }
public async Task <bool> SignInAsync(MembersIndexVM membersIndexVM) { var result = await signInManager.PasswordSignInAsync(membersIndexVM.Email, membersIndexVM.Password, false, false); return(result.Succeeded); }