/// <summary>
 /// Adds the specified instance.
 /// </summary>
 /// <param name="instance">The instance.</param>
 public void Add(UploadImage2 instance)
 {
     using (var db = new DemoDbContext())
     {
         db.UploadImage2.Add(instance);
         db.SaveChanges();
     }
 }
        /// <summary>
        /// Updates the specified instance.
        /// </summary>
        /// <param name="instance">The instance.</param>
        public void Update(UploadImage2 instance)
        {
            using (var db = new DemoDbContext())
            {
                var target = db.UploadImage2.SingleOrDefault(x => x.ID == instance.ID);
                if (target == null)
                {
                    return;
                }

                target.CropImage   = instance.CropImage;
                target.SelectionX1 = instance.SelectionX1;
                target.SelectionX2 = instance.SelectionX2;
                target.SelectionY1 = instance.SelectionY1;
                target.SelectionY2 = instance.SelectionY2;
                target.UpdateDate  = DateTime.Now;
                db.SaveChanges();
            }
        }