public static void PopulateSets(Activity activity) { // Add Warm-up Sets // Sets cannot be less than the weight of the bar (45 lbs) activity.WarmupSets.Add(new Set(5, Math.Max(45, (int)Math.Floor(activity.Weight * 0.4 / 5) * 5))); activity.WarmupSets.Add(new Set(5, Math.Max(45, (int)Math.Floor(activity.Weight * 0.4 / 5) * 5))); activity.WarmupSets.Add(new Set(3, Math.Max(45, (int)Math.Floor(activity.Weight * 0.6 / 5) * 5))); activity.WarmupSets.Add(new Set(2, Math.Max(45, (int)Math.Floor(activity.Weight * 0.85 / 5) * 5))); // Add Work Sets activity.WorkSets.Add(new Set(5, activity.Weight)); }
public virtual void AddActivity(Activity activity) { activity.Workout = this; this.Activities.Add(activity); }
/// <summary> /// Saves or updates the specified activity. /// </summary> /// <param name="activity">The activity to save or update.</param> public void Save(Activity activity) { using (ISession session = NHibernateHelper.GetCurrentSession()) using (ITransaction transaction = session.BeginTransaction()) { session.SaveOrUpdate(activity); transaction.Commit(); } }