Exemplo n.º 1
0
        public void DeletePhoto(HomePagePhoto photo)
        {
            using (var scope = new TransactionScope())
            {
                homePageRepository.Delete(photo);
                homePageRepository.SaveChanges();

                EnsureDisplayOrders();
                homePageRepository.SaveChanges();

                photoService.DeletePhoto(photo.PhotoPath);
                scope.Complete();
            }
        }
Exemplo n.º 2
0
        public void SavePhotos(IEnumerable<HomePagePhoto> photos)
        {
            using (var scope = new TransactionScope())
            {
                foreach (var photo in photos)
                {
                    if (photo.HomePagePhotoId == 0)
                    {
                        homePageRepository.Create(photo);
                    }
                    else
                    {
                        homePageRepository.Update(photo);
                    }
                }
                homePageRepository.SaveChanges();

                EnsureDisplayOrders(photos.OrderBy(d=>d.DisplayOrder));
                homePageRepository.SaveChanges();
                scope.Complete();
            }
        }