示例#1
0
        public static void Add(User user)
        {
            using (var db = new UsersDbContext())
            {
                var nextId = db.Users.Count() + 1;
                user.Id = nextId;

                db.Users.Add(user);
                db.UserActivities.Add(new UserActivity {
                    User = user, Activity = "Creted by new user.", TimeStamp = DateTime.Now, Id = Guid.NewGuid()
                });
                db.SaveChanges();
            }
        }