/// <summary> /// Добавление бланка регистрации на мероприятие /// </summary> /// <returns></returns> public async Task <IActionResult> CreateEntranceTestRegistrationForm(int appUserLmsEventId) { var abiturient = await _abiturientRepository.GetAbiturientAsync(User.Identity.Name); if (abiturient == null) { return(NotFound()); } var appUserLmsEvent = await _appUserLmsEventRepository.GetAppUserLmsEventAsync(appUserLmsEventId); if (appUserLmsEvent == null) { return(NotFound()); } var entranceTestRegistrationForm = new EntranceTestRegistrationForm { AbiturientId = abiturient.AbiturientId, Code = abiturient.AbiturientId.ToString(), DisciplineName = appUserLmsEvent.LmsEvent.Description, LmsEventId = appUserLmsEvent.LmsEventId, FirstName = appUserLmsEvent.AppUser.FirstName, LastName = appUserLmsEvent.AppUser.LastName, Patronymic = appUserLmsEvent.AppUser.Patronymic, Date = appUserLmsEvent.LmsEvent.DateTimeStart.Date }; ViewBag.AppUserLmsEventId = appUserLmsEventId; return(View(entranceTestRegistrationForm)); }
public async Task <IActionResult> AddStudentFromListExistedUsersNotStudents(int studentGroupId, string userName) { AppUser studentAppUser = await _context.Users.FirstOrDefaultAsync(u => u.UserName == userName); if (studentAppUser != null) { // Создаём объект Student Student newStudent = new Student(); newStudent.StudentFio = $"{studentAppUser.LastName} {studentAppUser.FirstName} {studentAppUser.Patronymic}"; newStudent.AppUserId = studentAppUser.Id; newStudent.StudentGroupId = studentGroupId; var addedStudent = await _studentRepository.AddStudentAsync(newStudent); if (addedStudent.StudentId != 0) { var abiturient = await _abiturientRepository.GetAbiturientAsync(userName); if (abiturient != null) { await _abiturientRepository.SetAbiturientStatusAsync(abiturient, AbiturientStatusEnum.AddedToStudGroup); } } return(RedirectToAction(nameof(Index))); } else { ModelState.AddModelError("", "Пользователь не найден"); } return(RedirectToAction(nameof(AddStudentFromListExistedUsersNotStudents), new { StudentGroupId = studentGroupId })); }
/// <summary> /// Удаление аккаунта и всех данных абитуриента /// </summary> /// <param name="userName"></param> /// <returns></returns> public async Task <IActionResult> Delete(string userName) { var appUser = await _abiturRepository.GetAbiturientAsync(userName); return(View(appUser)); }