//TODO: Sprawdzić public async Task <ApiResponse> CoachCancelManagment(CoachCancelManagmentVm coachCancelManagmentVm) { var user = _unitOfWork.userRepository.FindByCondition(x => x.Id == coachCancelManagmentVm.ProfilePupilId).FirstOrDefault(); var userCoach = _unitOfWork.userRepository.FindByCondition(x => x.Id == coachCancelManagmentVm.ProfileCoachId).FirstOrDefault(); var status = coachCancelManagmentVm.Partnership; if (user == null && userCoach == null && user.Id != userCoach.Id && status == true) { throw new MyNotFoundException(ApiResponseDescription.USER_NOT_FOUND); } var pupil = _unitOfWork.pupilRepository.FindByCondition(x => x.ProfileCoachId == userCoach.Id && x.ProfilePupilId == user.Id).FirstOrDefault(); pupil.Partnership = status; _unitOfWork.pupilRepository.Update(pupil); var coachRequest = _unitOfWork.coachingRequestRepository.FindByCondition(x => x.CoachId == userCoach.Id && x.ApplicationUserId == user.Id).FirstOrDefault(); coachRequest.Status = (CoachingRequestStatus)2; _unitOfWork.coachingRequestRepository.Update(coachRequest); await _unitOfWork.CompleteAsync(); return(new ApiResponse(true)); }
public async Task <IActionResult> CoachCancelManagment([FromBody] CoachCancelManagmentVm coachCancelManagmentVm) => Ok(await _coachService.CoachCancelManagment(coachCancelManagmentVm));