public async Task <IHttpActionResult> GetSport(int id) { Sport sport = await sportRepository.GetById(id); if (sport == null) { return(NotFound()); } return(Ok(sport)); }
public async Task <ActionResult> Post([FromBody] Training training) { if (training == null) { return(NotFound("Getting null for training")); } var tmpCoach = _coachRepo.GetById(training.Coach.CoachID); var tmpSport = _sportRepo.GetById(training.Sport.SportID); var tmpMember = _memberRepo.GetById(training.Member.MemberID); Training trainingTmp = new Training() { Coach = tmpCoach, Sport = tmpSport, Member = tmpMember, TimeAndDateOfTraining = training.TimeAndDateOfTraining }; if (trainingTmp == null) { return(NotFound("Getting null for trainingTmp")); } await _trainingRepo.Post(trainingTmp); return(Ok(trainingTmp)); }