public void AddWorkoutTest() { AddWorkout workout = new AddWorkout(); workout.UserId = testID; workout.WorkoutName = "test workout"; int worked = _db.AddWorkout(workout); //tests AddWorkout method Assert.IsNotNull(worked); int testWorkout_Exervise = _db.AddExercise(worked, "Test Exercise"); // tests AddExercise method, returns WE_Id Assert.IsNotNull(testWorkout_Exervise); }
public ActionResult SubmitNewWorkout(string WorkoutName) { AddWorkout newWorkout = new AddWorkout(); newWorkout.WorkoutName = WorkoutName; User user = Session[UserKey] as User; newWorkout.UserId = user.Id; int workoutID = _dal.AddWorkout(newWorkout); if (workoutID != BaseModel.InvalidId) { return(RedirectToAction("Workout", "WorkoutManager", new { id = workoutID })); } else { return(RedirectToAction("Index")); } }