コード例 #1
0
        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();
        }
コード例 #2
0
ファイル: APBDDbService.cs プロジェクト: s16500/test2
        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);
        }
コード例 #3
0
ファイル: StudentDbService.cs プロジェクト: s13648/Cw10
        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();
        }