public void CreatePicture(PictureBll picture) { if (picture == null) { throw new ArgumentNullException("picture"); } var pictureDal = picture.ToDal(); repository.Create(pictureDal); uow.Commit(); }
public void UpdatePicture(PictureBll picture) { if (picture == null) { throw new ArgumentNullException("picture"); } PictureDal currentPicture = picture.ToDal(); PictureDal existedPicture = repository.GetById(picture.Id); if (existedPicture == null) { throw new EntityNotFoundException("picture", picture.Id); } existedPicture.Image = currentPicture.Image; existedPicture.Hash = currentPicture.Hash; existedPicture.Name = currentPicture.Name; repository.Update(existedPicture); uow.Commit(); }