コード例 #1
0
 /// <summary>
 /// Adds the specified instance.
 /// </summary>
 /// <param name="instance">The instance.</param>
 public void Add(UploadImage2 instance)
 {
     using (ImageCropEntities db = new ImageCropEntities())
     {
         db.UploadImage2.AddObject(instance);
         db.SaveChanges();
     }
 }
コード例 #2
0
 /// <summary>
 /// Updates the specified id.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="cropImage">The crop image.</param>
 public void Update(Guid id, string cropImage)
 {
     using (ImageCropEntities db = new ImageCropEntities())
     {
         var target = db.UploadImage.SingleOrDefault(x => x.ID == id);
         target.CropImage  = cropImage;
         target.UpdateDate = DateTime.Now;
         db.SaveChanges();
     }
 }
コード例 #3
0
        /// <summary>
        /// Deletes the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        public void Delete(Guid id)
        {
            var item = this.FindOne(id);

            if (item != null)
            {
                using (ImageCropEntities db = new ImageCropEntities())
                {
                    var target = db.UploadImage2.SingleOrDefault(x => x.ID == id);
                    db.DeleteObject(target);
                    db.SaveChanges();
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Updates the specified instance.
 /// </summary>
 /// <param name="instance">The instance.</param>
 public void Update(UploadImage2 instance)
 {
     using (ImageCropEntities db = new ImageCropEntities())
     {
         var target = db.UploadImage2.SingleOrDefault(x => x.ID == instance.ID);
         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();
     }
 }