Example #1
0
        private static void AddUser(mapContext db, string emailAddress)
        {
            Mapuser mu = new Mapuser {
                Email = emailAddress
            };

            db.Mapuser.Add(mu);
            db.SaveChanges();

            Console.WriteLine(mu.Id + " " + mu.Email);
        }
Example #2
0
        private static void AddItem(mapContext db, string who)
        {
            // get the user
            var me = db.Mapuser
                     .Single(u => u.Email.ToString() == who);

            // get the first action
            var action = db.Actions
                         .Single(i => i.Id == 1);

            // New up an object
            var ua = new Useractions();

            ua.Actions    = action;
            ua.User       = me;
            ua.Actiondate = DateTime.Now;

            // Save it
            db.Useractions.Add(ua);
            db.SaveChanges();

            // if it returns an ID, we're good
            Console.WriteLine("Done: " + ua.Id);
        }
Example #3
0
 public void Commit()
 {
     dataContext.SaveChanges();
 }