// GET: Workouts/Create public async Task <ActionResult> Create() { var user = await userManager.FindByIdAsync(User.Identity.GetUserId()); if (user == null) { return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); } var exerciseTypeOptions = exerciseTypeService.GetAll(user.Id).ToList(); if (exerciseTypeOptions.Count == 0) { return(Redirect("/Exercises/All")); } ViewBag.ExerciseTypeOptions = exerciseTypeOptions; var workoutVM = new WorkoutViewModel(); workoutVM.WorkoutDate = DateTime.Today; workoutVM.Exercises.Add(new ExerciseViewModel()); workoutVM.Exercises.First().Sets.Add(new SetViewModel()); workoutVM.Exercises.First().Sets.Add(new SetViewModel()); workoutVM.Exercises.First().Sets.Add(new SetViewModel()); return(View(workoutVM)); }
// GET: Workout public ActionResult Index() { var service = new ExerciseTypeService(Constants.Database.DBKey); ViewBag.AllWorkoutTypes = service.GetAll(); return(View()); }
// GET: ExerciseTypes public ActionResult Index() { var service = new ExerciseTypeService(Common.Constants.Database.DBKey); var exerciseTypes = service.GetAll(); return(View(exerciseTypes)); }
// GET: Exercises/All public async Task <ActionResult> All() { var user = await userManager.FindByIdAsync(User.Identity.GetUserId()); if (user == null) { return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); } var allExerciseTypesDTO = exerciseTypeService.GetAll(user.Id); var allExerciseTypesVM = new List <ExerciseTypeListViewModel>(); foreach (var e in allExerciseTypesDTO) { allExerciseTypesVM.Add(MapExerciseTypeDTO(e)); } return(View(allExerciseTypesVM)); }
// GET: Workout public ActionResult Index() { var service = new ExerciseTypeService(Constants.Database.DBKey); ViewBag.AllWorkoutTypes = service.GetAll(); return View(); }
public ActionResult GetAllWorkouts() { var service = new ExerciseTypeService(Constants.Database.DBKey); return new JsonActionResult(service.GetAll(), JsonRequestBehavior.AllowGet); }
// GET: ExerciseTypes public ActionResult Index() { var service = new ExerciseTypeService(Common.Constants.Database.DBKey); var exerciseTypes = service.GetAll(); return View(exerciseTypes); }
public ActionResult GetAllWorkouts() { var service = new ExerciseTypeService(Constants.Database.DBKey); return(new JsonActionResult(service.GetAll(), JsonRequestBehavior.AllowGet)); }