Esempio n. 1
0
        public string ImageProfileList(int imageId)
        {
            var selectedImage = BLL.Image.GetImage(imageId);

            if (selectedImage.Environment == "winpe")
            {
                var imageProfileList = new Services.Client.WinPEProfileList {
                    ImageProfiles = new List <WinPEProfile>()
                };
                int profileCounter = 0;
                foreach (var imageProfile in BLL.ImageProfile.SearchProfiles(Convert.ToInt32(imageId)).OrderBy(x => x.Name))
                {
                    profileCounter++;
                    var winpeProfile = new Services.Client.WinPEProfile();
                    winpeProfile.ProfileId   = imageProfile.Id.ToString();
                    winpeProfile.ProfileName = imageProfile.Name;
                    imageProfileList.ImageProfiles.Add(winpeProfile);

                    if (profileCounter == 1)
                    {
                        imageProfileList.FirstProfileId = imageProfile.Id.ToString();
                    }
                }
                imageProfileList.Count = profileCounter.ToString();
                return(JsonConvert.SerializeObject(imageProfileList));
            }
            else
            {
                var imageProfileList = new Services.Client.ImageProfileList {
                    ImageProfiles = new List <string>()
                };

                int profileCounter = 0;
                foreach (var imageProfile in BLL.ImageProfile.SearchProfiles(Convert.ToInt32(imageId)))
                {
                    profileCounter++;
                    imageProfileList.ImageProfiles.Add(imageProfile.Id + " " + imageProfile.Name);
                    if (profileCounter == 1)
                    {
                        imageProfileList.FirstProfileId = imageProfile.Id.ToString();
                    }
                }

                imageProfileList.Count = profileCounter.ToString();
                return(JsonConvert.SerializeObject(imageProfileList));
            }
        }
Esempio n. 2
0
        public string ImageProfileList(int imageId)
        {
            var selectedImage = BLL.Image.GetImage(imageId);
            if (selectedImage.Environment == "winpe")
            {
                var imageProfileList = new Services.Client.WinPEProfileList { ImageProfiles = new List<WinPEProfile>() };
                int profileCounter = 0;
                foreach (var imageProfile in BLL.ImageProfile.SearchProfiles(Convert.ToInt32(imageId)).OrderBy(x => x.Name))
                {
                    profileCounter++;
                    var winpeProfile = new Services.Client.WinPEProfile();
                    winpeProfile.ProfileId = imageProfile.Id.ToString();
                    winpeProfile.ProfileName = imageProfile.Name;
                    imageProfileList.ImageProfiles.Add(winpeProfile);

                    if (profileCounter == 1)
                        imageProfileList.FirstProfileId = imageProfile.Id.ToString();
                }
                imageProfileList.Count = profileCounter.ToString();
                return JsonConvert.SerializeObject(imageProfileList);

            }
            else
            {
                var imageProfileList = new Services.Client.ImageProfileList {ImageProfiles = new List<string>()};

                int profileCounter = 0;
                foreach (var imageProfile in BLL.ImageProfile.SearchProfiles(Convert.ToInt32(imageId)))
                {
                    profileCounter++;
                    imageProfileList.ImageProfiles.Add(imageProfile.Id + " " + imageProfile.Name);
                    if (profileCounter == 1)
                        imageProfileList.FirstProfileId = imageProfile.Id.ToString();
                }

                imageProfileList.Count = profileCounter.ToString();
                return JsonConvert.SerializeObject(imageProfileList);
            }
        }