Beispiel #1
0
        public IActionResult Create(int id)
        {
            var viewModel = new AttendancesCreateViewModel
            {
                StudentId = id,
            };

            return(this.View(viewModel));
        }
Beispiel #2
0
        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 }));
        }