public ActionResult ActiveAthletesPaging([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel) { requestModel.Draw++; var orderedEnumerable = requestModel.Columns.GetSortedColumns(); var orderByColumn = int.Parse(orderedEnumerable.First().Data); var orderDirection = orderedEnumerable.First().SortDirection == 0 ? OrderDirection.Ascendant : OrderDirection.Descendant; var searchValue = requestModel.Search.Value; var request = new GetFilteredAthletesRequest { OrderByColumn = orderByColumn, OrderDirection = orderDirection, SearchValue = searchValue, Start = requestModel.Start, Length = requestModel.Length, WithExercisesOfTheDay = true, WithStatistics = true }; var response = _athleteService.GetFilteredAthletes(request); var workoutOfTheDayViewModel = new WorkoutOfTheDayViewModelBuilder() .WithDataTableRows(response.FilteredAthletes, response.ExercisesOfTheDay.ToList()) .Build(); var recordsTotal = response.RecordsTotal; var recordsFiltered = response.RecordsFiltered; var paged = workoutOfTheDayViewModel.DataTableRows; return Json(new DataTablesResponse(requestModel.Draw, paged, recordsFiltered, recordsTotal), JsonRequestBehavior.AllowGet); }
public ActionResult ActiveAthletes() { var request = new GetExercisesOfTheDayRequest(); var response = _statisticsService.GetExercisesOfTheDay(request); var workoutOfTheDayViewModel = new WorkoutOfTheDayViewModelBuilder() .WithValues(response.Exercises) .Build(); ViewBag.WorkoutOfTheDayActive = "active"; return View(workoutOfTheDayViewModel); }