public IActionResult WorkoutDetails() { string name = Request.Path.Value.Split('/').LastOrDefault(); var targetWorkout = _db.Workouts .Include(w => w.Exercises) .ThenInclude(e => e.Bodypart) .Include(w => w.Exercises) .ThenInclude(e => e.Category).FirstOrDefault(w => w.Name == name); WorkoutDetailsViewModel workout = new WorkoutDetailsViewModel() { Exercises = targetWorkout.Exercises.ToList(), Name = targetWorkout.Name }; //{ // Name = w.Name, // Exercises = w.Exercises.ToList() //}).FirstOrDefault(w => w.Name == name); return(View("WorkoutDetails", workout)); }
private async Task <Dictionary <string, List <string> > > GetApplicablePaymentMethodsByTypeAsync(WorkoutDetailsViewModel workout) { var paymentMethods = await this.paymentMethodsService.GetAllAsync(); var paymentMethodsInAdvance = paymentMethods .Where(pia => pia.PaymentInAdvance == true && workout.AcceptedPaymentMethods.Contains(pia.Name)) .Select(n => n.Name) .ToList(); var paymentMethodsOnSite = paymentMethods .Where(pia => pia.PaymentInAdvance == false && workout.AcceptedPaymentMethods.Contains(pia.Name)) .Select(n => n.Name) .ToList(); var paymentMethodsByType = new Dictionary <string, List <string> >() { { "paymentMethodsInAdvance", paymentMethodsInAdvance }, { "paymentMethodsOnSite", paymentMethodsOnSite }, }; return(paymentMethodsByType); }
public WorkoutDetailsPage(Workout workout) { InitializeComponent(); BindingContext = WorkoutDetailsViewModel = new WorkoutDetailsViewModel(workout); }