/// <summary> /// Updates single student which that equals <paramref name="updateStudentDTO"/> in repository by <paramref name="updateStudentDTO"/>'s properties by mentor. /// </summary> /// <param name="updateStudentDTO">Student to be updated.</param> /// <param name="Id">Id of student to be updated.</param> /// <returns></returns> public async Task UpdateStudentByMentorAsync(UpdateStudentByMentorDTO updateStudentDTO, Guid Id) { var toBeUpdatedStudent = await _studentRepository.GetByIdAsync(Id).ConfigureAwait(false); toBeUpdatedStudent.ThrowIfNullForGuidObject(); toBeUpdatedStudent.Name = updateStudentDTO.Name; toBeUpdatedStudent.Surname = updateStudentDTO.Surname; toBeUpdatedStudent.Level = updateStudentDTO.Level; toBeUpdatedStudent.University = updateStudentDTO.University; toBeUpdatedStudent.Age = updateStudentDTO.Age; toBeUpdatedStudent.HomeAddress = updateStudentDTO.HomeAddress; toBeUpdatedStudent.MentorThoughts = updateStudentDTO.MentorThoughts; toBeUpdatedStudent.GraduationStatus = updateStudentDTO.GraduationStatus; toBeUpdatedStudent.CurrentAssigmentDeliveryDate = updateStudentDTO.CurrentAssigmentDeliveryDate; toBeUpdatedStudent.GraduationScore = updateStudentDTO.GraduationScore; toBeUpdatedStudent.MentorGraduationThoughts = updateStudentDTO.MentorGraduationThoughts; toBeUpdatedStudent.ProfessionId = updateStudentDTO.ProfessionId; await _studentRepository.UpdateAsync(toBeUpdatedStudent).ConfigureAwait(false); }
public async Task <IActionResult> UpdateStudentbyMentor([FromBody] UpdateStudentByMentorDTO updateStudent, Guid Id) { return(await _studentService.UpdateStudentByMentorAsync(updateStudent, Id).ConfigureAwait(false).GetObjectResponseAsync <UpdateStudentDTO>("Success").ConfigureAwait(false)); }