예제 #1
0
        public void CreatePicture(PictureBll picture)
        {
            if (picture == null)
            {
                throw new ArgumentNullException("picture");
            }

            var pictureDal = picture.ToDal();

            repository.Create(pictureDal);
            uow.Commit();
        }
예제 #2
0
        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();
        }