public static async Task<byte[]> CreateWorkoutPDF(WorkoutLogDTO workoutLog) { string uri = "PrintWorkout"; byte[] responseWorkoutLog = null; try { string rawJSON = JsonConvert.SerializeObject(workoutLog); responseWorkoutLog = await BaseCoachServices.ServiceAPI.PostByteArrayResponse(uri, rawJSON); } catch (Exception e) { Insights.Report(e); } return responseWorkoutLog; }
private async void ExecutePrintCommand (UserExerciseGroupViewModel userExerciseGroup) { if (IsBusy) return; IsBusy = true; if (CrossConnectivity.Current.IsConnected) { var print = DependencyService.Get<IPrinter> (); //TODO: need to pass url returned from API WorkoutLogDTO workoutLog = new WorkoutLogDTO (); workoutLog.GymID = App.WorkoutCreatorContext.StaffMember.GymID; workoutLog.ProfileID = SelectedUser.ProfileID; workoutLog.UserWorkoutGroupID = userExerciseGroup.ServerID; var workoutLogResponse = await CoachServices.CreateWorkoutPDF (workoutLog); print.PrintPage ("Member Workout", workoutLogResponse); } else { DependencyService.Get<ICustomDialog> ().Display ("There was a problem creating your workout. Please try again.", "OK"); } IsBusy = false; }