Exemple #1
0
        public FrmEdit(DBAppunto appunto)
        {
            InitializeComponent();

            if( appunto == null)
            {
                _selectedAppunto = new DBAppunto();
                lblHeader.Content = "Nuova Nota";
            }
            else
            {
                _selectedAppunto = appunto;
                lblHeader.Content = "Modifica Nota";
            }

            IEnumerable<DBImage> images = Appunto.GetImages();
            if( images != null)
                foreach (DBImage item in images)
                {
                    ImageGallery img = new ImageGallery(item);
                    gallery.Children.Add(img);
                    img.Load();
                }
            this.DataContext = Appunto;
        }
Exemple #2
0
        internal static void DeleteImages(ImageGallery[] images)
        {
            using (OmeopautaContext db = new OmeopautaContext())
            {
                foreach (ImageGallery item in images)
                {
                    if (item.DBImg.ID == 0) continue;
                    db.Images.Attach(item.DBImg);
                    db.Images.Remove(item.DBImg);
                    if (item.DBImg.tmpPath == null)
                    {
                        item.DeleteImage();
                    }

                }
                db.SaveChanges();
            }
        }