public async Task <IActionResult> GetClubMember([FromQuery] int athleteId) { var response = new SingleModelResponse <ClubMember>() as ISingleModelResponse <ClubMember>; try { if (athleteId < 1) { throw new Exception("Model is missing"); } response.Model = await Task.Run(() => { ClubMember member = _context.GetMemberByID(athleteId); if (member == null) { throw new Exception("Club Member does not Exist"); } return(member); }); } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.ToHttpResponse()); }
public IActionResult GetClubMember(int memberId) { if (ModelState.IsValid) { ClubMember club = _memberRepo.GetMemberByID(memberId); if (club == null) { return(NotFound()); } return(Json(club)); } else { return(BadRequest(ModelState)); } }