Skip to content

Instantly share code, notes, and snippets.

@marking
Created January 24, 2014 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marking/8598964 to your computer and use it in GitHub Desktop.
Save marking/8598964 to your computer and use it in GitHub Desktop.
public static void SaveUser(User userToSave)
{
using (var assembleContainer = BuildAssembleContainer())
{
var userRepository = assembleContainer.Resolve<IUserRepository>();
var user = userRepository.GetById(userToSave.Id);
if (user == null)
{
throw new ArgumentException(string.Format("A User with id={0} does not exist in the database", userToSave.Id));
}
userRepository.InsertOrUpdate(user);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment