public IActionResult Create(int id) { var viewModel = new AttendancesCreateViewModel { StudentId = id, }; return(this.View(viewModel)); }
public async Task <IActionResult> CreateAsync(AttendancesCreateViewModel inputModel) { if (!this.ModelState.IsValid) { return(this.View(inputModel)); } var studentId = inputModel.StudentId; var user = await this.userManager.GetUserAsync(this.User); var userId = await this.userManager.GetUserIdAsync(user); var techer = this.teacherServises.GetUserTeacher(userId); var attendanceId = await this.atendacesServices.CreateAsync(inputModel.Remark, inputModel.StudentId, techer.Id); await this.studentsServices.AddAttendanceToStudent(studentId, attendanceId); return(this.RedirectToAction("Details", new { id = attendanceId })); }