Ejemplo n.º 1
0
        public override void ExecuteCmdlet()
        {
            IEnumerable <VMTemplate> results = null;
            var vmTemplateOperations         = new VMTemplateOperations(this.WebClientFactory);

            if (this.ParameterSetName == WAPackCmdletParameterSets.Empty)
            {
                results = vmTemplateOperations.Read();
            }
            else if (this.ParameterSetName == WAPackCmdletParameterSets.FromId)
            {
                VMTemplate vmTemplate = null;
                vmTemplate = vmTemplateOperations.Read(ID);
                results    = new List <VMTemplate>()
                {
                    vmTemplate
                };
            }
            else if (this.ParameterSetName == WAPackCmdletParameterSets.FromName)
            {
                results = vmTemplateOperations.Read(new Dictionary <string, string>()
                {
                    { "Name", Name }
                });
            }

            this.GenerateCmdletOutput(results);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(VMTemplate vmtemplate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vmtemplate).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index"));
     }
     return(View(vmtemplate));
 }
Ejemplo n.º 3
0
 public ActionResult Create(VMTemplate vmtemplate)
 {
     try { if (ModelState.IsValid)
           {
               db.VMTemplates.Add(vmtemplate); db.SaveChanges(); return(View("Success"));
           }
           return(View(vmtemplate)); } catch (Exception e) { Api.Core.Exceptions.ExceptionManager.HandleException(e); return(View("Error")); }
 }
Ejemplo n.º 4
0
        //
        // GET: /VMTemplate/Delete/5

        public ActionResult Delete(int id = 0)
        {
            VMTemplate vmtemplate = db.VMTemplates.Find(id); if (vmtemplate == null)

            {
                return(HttpNotFound());
            }
            return(View(vmtemplate));
        }
Ejemplo n.º 5
0
 public ActionResult DeleteConfirmed(int id)
 {
     VMTemplate vmtemplate = db.VMTemplates.Find(id); db.VMTemplates.Remove(vmtemplate); db.SaveChanges(); return(RedirectToAction("Index"));
 }
Ejemplo n.º 6
0
 public static VMTemplate CreateVMTemplate(global::System.Guid stampId, global::System.Guid ID, global::System.Collections.ObjectModel.ObservableCollection<UserAndRole> grantedToList, global::System.Collections.ObjectModel.ObservableCollection<string> bootOrder, global::System.Collections.ObjectModel.ObservableCollection<string> customProperties, global::System.Collections.ObjectModel.ObservableCollection<string> guiRunOnceCommands, global::System.Collections.ObjectModel.ObservableCollection<string> serverFeatures, global::System.Collections.ObjectModel.ObservableCollection<string> sANStatus)
 {
     VMTemplate vMTemplate = new VMTemplate();
     vMTemplate.StampId = stampId;
     vMTemplate.ID = ID;
     if ((grantedToList == null))
     {
         throw new global::System.ArgumentNullException("grantedToList");
     }
     vMTemplate.GrantedToList = grantedToList;
     if ((bootOrder == null))
     {
         throw new global::System.ArgumentNullException("bootOrder");
     }
     vMTemplate.BootOrder = bootOrder;
     if ((customProperties == null))
     {
         throw new global::System.ArgumentNullException("customProperties");
     }
     vMTemplate.CustomProperties = customProperties;
     if ((guiRunOnceCommands == null))
     {
         throw new global::System.ArgumentNullException("guiRunOnceCommands");
     }
     vMTemplate.GuiRunOnceCommands = guiRunOnceCommands;
     if ((serverFeatures == null))
     {
         throw new global::System.ArgumentNullException("serverFeatures");
     }
     vMTemplate.ServerFeatures = serverFeatures;
     if ((sANStatus == null))
     {
         throw new global::System.ArgumentNullException("sANStatus");
     }
     vMTemplate.SANStatus = sANStatus;
     return vMTemplate;
 }