예제 #1
0
        public string UpdateGuid(int profileId)
        {
            var imageProfile  = new ImageProfileServices().ReadProfile(profileId);
            var imageServices = new ImageServices();
            var image         = imageServices.GetImage(imageProfile.ImageId);
            var guid          = Guid.NewGuid().ToString();

            image.LastUploadGuid = guid;
            imageServices.UpdateImage(image);
            return(guid);
        }
예제 #2
0
        public string ImageProfileList(int imageId)
        {
            var imageServices = new ImageServices();
            var selectedImage = imageServices.GetImage(imageId);

            if (selectedImage.Environment == "winpe")
            {
                var imageProfileList = new WinPEProfileList {
                    ImageProfiles = new List <WinPEProfile>()
                };
                var profileCounter = 0;
                foreach (var imageProfile in imageServices.SearchProfiles(Convert.ToInt32(imageId)).OrderBy(x => x.Name)
                         )
                {
                    profileCounter++;
                    var winpeProfile = new 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 ImageProfileList {
                    ImageProfiles = new List <string>()
                };

                var profileCounter = 0;
                foreach (var imageProfile in imageServices.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));
            }
        }