public ExerciseTypeViewModel(ExerciseType exerciseType, FitnessTrackerDataContext dc)
 {
     dataContext = dc;
     ExerciseType = exerciseType;
     exerciseTypeRepository =  new ExerciseTypeRepository(dc);
     HasDistanceDataSelectList = CreateHasDistanceDataSelectList();
 }
        public ActionResult Delete(int id, ExerciseType exerciseTypeToDelete)
        {
            try
            {
                ExerciseType exerciseTypePreviouslySaved = exerciseTypeRepository.GetExerciseType(id);
                exerciseTypeRepository.Delete(exerciseTypePreviouslySaved);
                exerciseTypeRepository.Save();

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
		private void detach_ExerciseTypes(ExerciseType entity)
		{
			this.SendPropertyChanging();
			entity.DistanceUnit = null;
		}
 partial void DeleteExerciseType(ExerciseType instance);
 partial void UpdateExerciseType(ExerciseType instance);
 partial void InsertExerciseType(ExerciseType instance);
 public double? GetMinSecondsPerUnit(ExerciseType exerciseType, DistanceUnit distanceUnit)
 {
     if (exerciseType.HasDistanceData != 'Y') return null;
     return GetDistanceInUnits(distanceUnit, (double)exerciseType.MinSecondsPerMile.Value);
 }
 public void Delete(ExerciseType exerciseType)
 {
     DataContext.ExerciseTypes.DeleteOnSubmit(exerciseType);
 }
 //
 // Insert/Delete Methods
 public void Add(ExerciseType exerciseType)
 {
     DataContext.ExerciseTypes.InsertOnSubmit(exerciseType);
 }
 public IQueryable<WorkoutRegimen> FindByExerciseType(FitnessUser fitnessUser, ExerciseType exerciseType)
 {
     var wrbu = FindAllWorkoutRegimensByUser(fitnessUser);
     return wrbu.Where(wr => (wr.ExerciseTypeId == exerciseType.ExerciseTypeId));
 }