public IActionResult Get(long id) { Athlete athlete = athleteRepository.GetById(id); if (athlete == null) { return(NotFound()); } var dto = new AthleteDto() { Id = athlete.Id, Name = athlete.Name.Value, Email = athlete.Email.Value, Status = athlete.Status.Type.ToString(), StatusExpirationDate = athlete.Status.ExpirationDate, MoneySpent = athlete.MoneySpent, PurchasedWorkoutRoutine = athlete.PurchasedWorkoutRoutine.Select(s => new PurchasedWorkoutRoutineDto() { WorkoutRoutine = new WorkoutRoutineDto() { Id = s.WorkoutRoutine.Id, Name = s.WorkoutRoutine.Name }, Price = s.Price, PurchaseDate = s.PurchaseDate, ExpirationDate = s.ExpirationDate }).ToList() }; return(Json(dto)); }
public IActionResult Get(long id) { Athlete athlete = athleteRepository.GetById(id); if (athlete == null) { return(NotFound()); } return(Json(athlete)); }