Exemple #1
0
        public async Task <StudentDetailsDto> Create(StudentCreationDto studentCreationDto)
        {
            Domain.Entities.Student student = studentMapper.Map(studentCreationDto);
            await writeRepository.AddNewAsync(student);

            await writeRepository.SaveAsync();

            return(studentMapper.Map(student));
        }
Exemple #2
0
 public Domain.Entities.Student Map(StudentCreationDto studentCreationDto)
 {
     return(new Domain.Entities.Student(
                studentCreationDto.RegistrationNumber,
                studentCreationDto.Email,
                studentCreationDto.Password,
                studentCreationDto.FirstName,
                studentCreationDto.LastName,
                studentCreationDto.YearOfStudy));
 }
Exemple #3
0
        public async Task <StudentDetailsDto> Update(Guid id, StudentCreationDto studentCreationDto)
        {
            StudentDetailsDto studentDetailsDto = studentMapper.Map(id, studentCreationDto);
            var student = GetStudentById(id).Result;

            writeRepository.Update(studentMapper.Map(studentDetailsDto, student));
            await writeRepository.SaveAsync();

            return(studentDetailsDto);
        }
Exemple #4
0
        public StudentDetailsDto Map(Guid id, StudentCreationDto studentCreationDto)
        {
            StudentDetailsDto studentDetailsDto = new StudentDetailsDto
            {
                Id                 = id,
                FirstName          = studentCreationDto.FirstName,
                LastName           = studentCreationDto.LastName,
                Email              = studentCreationDto.Email,
                RegistrationNumber = studentCreationDto.RegistrationNumber,
                YearOfStudy        = studentCreationDto.YearOfStudy,
                Password           = studentCreationDto.Password
            };

            return(studentDetailsDto);
        }