private IEnumerable <SelectListItem> Getsize() { VMManager vmm = new VMManager(ConfigurationManager.AppSettings["SubcriptionID"], ConfigurationManager.AppSettings["CertificateThumbprint"]); var swr = new StringWriter(); imageList = vmm.GetAzureVMSizes().Result; List <string> imageListRest = new List <string>(); var imgLst = new List <SelectListItem>(); foreach (KeyValuePair <string, string> entry in imageList) { imgLst.Add(new SelectListItem { Value = entry.Key, Text = entry.Value }); } return(imgLst); }
public JsonResult GetVmSizes() { VMManager vmm = new VMManager(ConfigurationManager.AppSettings["SubcriptionID"], ConfigurationManager.AppSettings["CertificateThumbprint"]); var swr = new StringWriter(); imageList = vmm.GetAzureVMSizes().Result; List <string> imageListRest = new List <string>(); var imgLst = new List <SelectListItem>(); foreach (KeyValuePair <string, string> entry in imageList) { imgLst.Add(new SelectListItem { Value = entry.Key, Text = entry.Value }); } TempData["Size"] = imgLst; return(Json(new { Status = 0, MessageTitle = "Success" })); }