Exemplo n.º 1
0
        public ImageModel GetImage(HttpPostedFileBase file)
        {
            ImageModel imgModel = new ImageModel();

            if (file != null && file.ContentLength > 0)
            {
                imgModel.description = System.IO.Path.GetFileName(file.FileName);
                using (var reader = new System.IO.BinaryReader(file.InputStream))
                    imgModel.image = reader.ReadBytes(file.ContentLength);
            }
            return imgModel;
        }
Exemplo n.º 2
0
 public void deleteImage(ImageModel image)
 {
     bdd.images.Remove(image);
 }
Exemplo n.º 3
0
 public void addImage(string description_param, byte[] image_param)
 {
     ImageModel img = new ImageModel { image = image_param, description = description_param };
     bdd.images.Add(img);
     bdd.SaveChanges();
 }