コード例 #1
0
        public string ImageList(string environment, int userId = 0)
        {
            var images = BLL.Image.GetOnDemandImageList(userId);

            if (environment == "winpe")
            {
                images = images.Where(x => x.Environment == "winpe").ToList();
                var imageList = new List <Services.Client.WinPEImageList>();
                foreach (var image in images)
                {
                    var winpeImage = new Services.Client.WinPEImageList();
                    winpeImage.ImageId   = image.Id.ToString();
                    winpeImage.ImageName = image.Name;
                    imageList.Add(winpeImage);
                }
                return(JsonConvert.SerializeObject(imageList));
            }
            else
            {
                var imageList = new Services.Client.ImageList {
                    Images = new List <string>()
                };
                if (environment == "macOS")
                {
                    images = images.Where(x => x.Environment == "macOS").ToList();
                }
                else if (environment == "linux")
                {
                    images = images.Where(x => x.Environment != "macOS" && x.Environment != "winpe").ToList();
                }
                foreach (var image in images)
                {
                    imageList.Images.Add(image.Id + " " + image.Name);
                }

                if (imageList.Images.Count == 0)
                {
                    imageList.Images.Add(-1 + " " + "No_Images_Found");
                }
                return(JsonConvert.SerializeObject(imageList));
            }
        }
コード例 #2
0
ファイル: Logic.cs プロジェクト: Terricide/clonedeploy
        public string ImageList(int userId = 0)
        {
            var imageList = new Services.Client.ImageList { Images = new List<string>() };

            foreach (var image in BLL.Image.GetOnDemandImageList(userId))
                imageList.Images.Add(image.Id + " " + image.Name);

            return JsonConvert.SerializeObject(imageList);
        }
コード例 #3
0
ファイル: Logic.cs プロジェクト: cdadmin/clonedeploy
        public string ImageList(string environment,int userId = 0)
        {
            var images = BLL.Image.GetOnDemandImageList(userId);
            if (environment == "winpe")
            {
                images = images.Where(x => x.Environment == "winpe").ToList();
                var imageList = new List<Services.Client.WinPEImageList>();
                foreach (var image in images)
                {
                    var winpeImage = new Services.Client.WinPEImageList();
                    winpeImage.ImageId = image.Id.ToString();
                    winpeImage.ImageName = image.Name;
                    imageList.Add(winpeImage);
                }
                return JsonConvert.SerializeObject(imageList);
            }
            else
            {
                var imageList = new Services.Client.ImageList {Images = new List<string>()};
                if (environment == "macOS")
                    images = images.Where(x => x.Environment == "macOS").ToList();
                else if (environment == "linux")
                    images = images.Where(x => x.Environment != "macOS" && x.Environment != "winpe").ToList();
                foreach (var image in images)
                    imageList.Images.Add(image.Id + " " + image.Name);

                if (imageList.Images.Count == 0)
                    imageList.Images.Add(-1 + " " + "No_Images_Found");
                return JsonConvert.SerializeObject(imageList);
            }
        }