/// <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 UpdateStudentByAdminAsync(UpdateStudentByAdminDTO updateStudentDTO, Guid Id) { var toBeUpdatedStudent = await _studentRepository.GetByIdAsync(Id).ConfigureAwait(false); toBeUpdatedStudent.ThrowIfNullForGuidObject(); toBeUpdatedStudent.Name = updateStudentDTO.Name; toBeUpdatedStudent.Surname = updateStudentDTO.Surname; toBeUpdatedStudent.University = updateStudentDTO.University; toBeUpdatedStudent.Age = updateStudentDTO.Age; toBeUpdatedStudent.IsConfidentialityAgreementSigned = updateStudentDTO.IsConfidentialityAgreementSigned; toBeUpdatedStudent.MentorId = updateStudentDTO.MentorId; await _studentRepository.UpdateAsync(toBeUpdatedStudent).ConfigureAwait(false); }
public async Task <IActionResult> UpdateStudentbyAdmin([FromBody] UpdateStudentByAdminDTO updateStudent, Guid Id) { return(await _studentService.UpdateStudentByAdminAsync(updateStudent, Id).ConfigureAwait(false).GetObjectResponseAsync <UpdateStudentDTO>("Success").ConfigureAwait(false)); }