public async Task UpdateAsync(EditViewModel inputModel) { AttendanceDTOBuilderData builderData = new AttendanceDTOBuilderData(inputModel); AttendanceDTO updatedAttendance = dtoFactory.CreateDTO <AttendanceDTOBuilderData, AttendanceDTO>(builderData); attendanceService.UpdateBaseInfo(updatedAttendance); await attendanceService.SaveChangesAsync(); }
public async Task UpdateAsync(EditViewModel viewModel) { SubmissionDTOBuilderData builderData = new SubmissionDTOBuilderData(viewModel); SubmissionDTO editedSubmission = dtoFactory.CreateDTO <SubmissionDTOBuilderData, SubmissionDTO>(builderData); service.UpdateDueDateCompletedAndGrade(editedSubmission); await service.SaveChangesAsync(); }
public async Task <int> CreateWorkDayAsync(CreateViewModel inputModel) { var builderData = new WorkDayDTOBuilderData(inputModel); WorkDayDTO newWorkDay = dtoFactory.CreateDTO <WorkDayDTOBuilderData, WorkDayDTO>(builderData); workDayService.Create(newWorkDay); await workDayService.SaveChangesAsync(); return(newWorkDay.Id); }
public async Task CreateWorkDayAsync(WorkDaysCreateViewModel viewModel) { JournalDTO journal = await service.GetByIdAsync(viewModel.JournalId); WorkDayDTOBuilderData builderData = new WorkDayDTOBuilderData(viewModel); WorkDayDTO newWorkDay = dtoFactory.CreateDTO <WorkDayDTOBuilderData, WorkDayDTO>(builderData); journal.WorkDays.Add(newWorkDay); await service.SaveChangesAsync(); }
public async Task <IdentityResult> CreateMentorAsync(CreateViewModel viewModel) { MentorDTOBuilderData builderData = new MentorDTOBuilderData(viewModel); MentorDTO newMenotor = dtoFactory.CreateDTO <MentorDTOBuilderData, MentorDTO>(builderData); IdentityResult result = await userManager.CreateAsync(newMenotor, viewModel.Password); if (result.Succeeded) { IdentityResult roleResult = userManager.AddToRole(newMenotor.Id, "Mentor"); } return(result); }
public async Task <IdentityResult> CreateAsync(CreateViewModel viewModel) { StudentDTOBuilderData builderData = new StudentDTOBuilderData(viewModel); StudentDTO newStudent = dtoFactory.CreateDTO <StudentDTOBuilderData, StudentDTO>(builderData); IdentityResult result = await userManager.CreateAsync(newStudent, viewModel.Password); if (result.Succeeded) { IdentityResult roleResult = userManager.AddToRole(newStudent.Id, "Student"); } return(result); }