/// <summary> /// Get the list of ApiKey entities owned by en-user /// </summary> /// <param name="userId">Id of the user for whome new key will be issued</param> /// <param name="description">Descritpion of an API key to be created</param> /// <returns></returns> public UserApiKey CreateUserApiKey(string userId, string description) { UserApiKey newKey = UserApiKey.CreateNew(_userRepository.GetById(new Guid(userId)), description); _userApiKeyRepository.Add(newKey); _userRepository.SaveChanges(); return(_userApiKeyRepository.GetById(newKey.Id)); }