public ViewAllController() { _workoutBAL = new WorkoutBAL(); _categoryBAL = new CategoryBAL(); _workouts = _workoutBAL.GetAllWorkouts(); _categories = _categoryBAL.GetAllCategories(); _workoutViewModel = new WorkoutViewModel() { Workouts = _workouts, Categories = _categories }; }
public ActionResult DeleteWorkout(int id) { var isWorkoutDeleted = _workoutBAL.DeleteWorkout(id); if (isWorkoutDeleted) { var workouts = _workoutBAL.GetAllWorkouts(); _workoutViewModel = new WorkoutViewModel() { Workouts = workouts }; } return(View("ViewAll", _workoutViewModel)); }
public IHttpActionResult Get() { var result = _workoutBAL.GetAllWorkouts(); return(Ok(result)); }