コード例 #1
0
 static void AddMuscleGroup(string name)
 {
     using (var db = new GymTrackerContext())
     {
         var newMuscleGroup = new MuscleGroup()
         {
             MuscleGroupName = name
         };
         db.MuscleGroups.Add(newMuscleGroup);
         db.SaveChanges();
     }
 }
コード例 #2
0
 static void AddUser(string name)
 {
     using (var db = new GymTrackerContext())
     {
         var newUser = new User()
         {
             UserName = name
         };
         db.Users.Add(newUser);
         db.SaveChanges();
     }
 }
コード例 #3
0
 static void AddSession(int user, int exersice, string date)
 {
     using (var db = new GymTrackerContext())
     {
         var newSession = new Session()
         {
             ExerciseId = exersice,
         };
         db.Sessions.Add(newSession);
         db.SaveChanges();
     }
 }
コード例 #4
0
 static void AddExersice(string name, int muslegroupid)
 {
     using (var db = new GymTrackerContext())
     {
         var newExersice = new Exercise()
         {
             ExerciseName  = name,
             MuscleGroupId = muslegroupid
         };
         db.Exercises.Add(newExersice);
         db.SaveChanges();
     }
 }
コード例 #5
0
 static void AddSets(int sessionid, int setnumber, int numofreps, int weight)
 {
     using (var db = new GymTrackerContext())
     {
         var newSet = new Set()
         {
             SessionId    = sessionid,
             SetNumber    = setnumber,
             NumberofReps = numofreps,
             Weight       = weight
         };
         db.Sets.Add(newSet);
         db.SaveChanges();
     }
 }