Skip to content

Instantly share code, notes, and snippets.

@mrcnkoba
Last active August 29, 2015 13:57
Show Gist options
  • Save mrcnkoba/9398489 to your computer and use it in GitHub Desktop.
Save mrcnkoba/9398489 to your computer and use it in GitHub Desktop.
public void Execute(UploadPhotoCommandHandler, ...)
{
...
var profile = ...;
.. //some validations if profile exists and so on
profile.UploadPhoto(@command.photo);
_profileRepository.Save(profile);
}
...
...
...
public class Profile
{
public Guid Id { get; private set; }
public Photo Photo { get; private set; }
...
...
...
public void UploadPhoto(Photo photo)
{
if (photo.Size > sth && photo.MimeType != "image/jpeg")
{
throw new ArgumentException("some msg");
}
Photo = photo;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment