コード例 #1
0
        private bool AddContact(Guid userId, Guid unknownContactId)
        {
            Log.Information($"Adding {unknownContactId} to {userId}'s contacts");
            var contact = new UserContact
            {
                UserId    = userId,
                ContactId = unknownContactId,
                CreatedOn = DateTime.UtcNow
            };

            _dbContext.Contacts.Add(contact);
            return(_dbContext.SaveChanges() == 1);
        }
コード例 #2
0
 private bool AddUser(User user)
 {
     Log.Information($"Add User with username: {user.Username}");
     _dbContext.Users.Add(user);
     return(_dbContext.SaveChanges() == 1);
 }