public async Task Promotions(Promotions promotions) { var newSemester = promotions.Semester + 1; var enrollmentDto = await GetBy(promotions.Studies, newSemester); int enrollmentId; if (enrollmentDto == null) { var studyDto = await studyDbService.GetByName(promotions.Studies); enrollmentId = await EnrollmentCreate(studyDto.IdStudy, newSemester); } else { enrollmentId = enrollmentDto.IdEnrollment; } var students = await GetStudentsBy(promotions.Studies, promotions.Semester); foreach (var student in students) { student.IdEnrollment = enrollmentId; } await context.SaveChangesAsync(); }
private async Task <BreedType> InsertBreed(POJO pOJO) { var breed = await _context.BreedTypes.AddAsync(new BreedType { Name = pOJO.Name, Description = "" }); await _context.SaveChangesAsync(); return(breed.Entity); }
public async Task Create(EnrollStudent model, int idEnrollment) { var student = new Student { BirthDate = model.BirthDate, FirstName = model.FirstName, LastName = model.LastName, IdEnrollment = idEnrollment, IndexNumber = model.IndexNumber }; await context.Students.AddAsync(student); await context.SaveChangesAsync(); }