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)); }
public Domain.Entities.Student Map(StudentCreationDto studentCreationDto) { return(new Domain.Entities.Student( studentCreationDto.RegistrationNumber, studentCreationDto.Email, studentCreationDto.Password, studentCreationDto.FirstName, studentCreationDto.LastName, studentCreationDto.YearOfStudy)); }
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); }
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); }