private Image CreateImageModel(string fileName, byte[] content)
        {
            var image = new Image
            {
                Content = content,
                FileExtension = fileName.Split(new[] { '.' }).Last()
            };

            return image;
        }
Exemplo n.º 2
0
        public Image Save(string name, string type, string path, string thumbnailPath)
        {
            var image = new Models.Image()
            {
                Name = name,
                FileExtension = type,
                Path = path,
                ThumbnailPath = thumbnailPath
            };

            this.images.Add(image);
            this.images.Save();

            return image;
        }
Exemplo n.º 3
0
        public string AddImage(string imageName)
        {
            var image = new Models.Image()
            {
                Name = imageName,
                Environment = "linux",
                Type = "Block",
                Enabled = 1,
                IsVisible = 1,
                Os = "",
                Description = ""
            };
            var result = BLL.Image.AddImage(image);
            if (result.IsValid)
                result.Message = image.Id.ToString();

            return JsonConvert.SerializeObject(result);
        }
Exemplo n.º 4
0
        public string AddImageWinPEEnv(string imageName)
        {
            var image = new Models.Image()
            {
                Name        = imageName,
                Environment = "winpe",
                Type        = "File",
                Enabled     = 1,
                IsVisible   = 1,
                Os          = "",
                Description = ""
            };
            var result = BLL.Image.AddImage(image);

            if (result.IsValid)
            {
                result.Message = image.Id.ToString();
            }

            return(JsonConvert.SerializeObject(result));
        }
Exemplo n.º 5
0
 public void MarkAsDeleted(Image image)
 {
     this.images.MarkAsDeleted(image);
     this.images.SaveChanges();
 }
Exemplo n.º 6
0
 public void Create(Image image)
 {
     this.images.Add(image);
     this.images.SaveChanges();
 }
Exemplo n.º 7
0
        public string AddImage(string imageName)
        {
            var image = new Models.Image()
            {
                Name = imageName
            };
            var result = BLL.Image.AddImage(image);
            if (result.IsValid)
                result.Message = image.Id.ToString();

            return JsonConvert.SerializeObject(result);
        }