示例#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
        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
        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();
        }