public DtoActionResult Put(EntityImageProfileTemplate template) { var result = _imageProfileTemplateService.UpdateTemplate(template); if (result == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(result); }
protected void btnUpdateSettings_OnClick(object sender, EventArgs e) { var template = new EntityImageProfileTemplate(); template.TemplateType = (EnumProfileTemplate.TemplateType) Enum.Parse(typeof(EnumProfileTemplate.TemplateType), ddlImageType.SelectedValue); template.Name = txtProfileName.Text; template.Description = txtProfileDesc.Text; template.Kernel = ddlKernel.Text; template.BootImage = ddlBootImage.Text; template.WebCancel = chkWebCancel.Checked; template.TaskCompletedAction = ddlTaskComplete.Text; template.ChangeName = chkChangeName.Checked; template.SkipExpandVolumes = chkDownNoExpand.Checked; template.FixBcd = chkAlignBCD.Checked; template.RandomizeGuids = chkRandomize.Checked; template.FixBootloader = chkRunFixBoot.Checked; template.SkipNvramUpdate = chkNvram.Checked; if (ddlImageType.Text == EnumProfileTemplate.TemplateType.LinuxBlock.ToString() || ddlImageType.Text == EnumProfileTemplate.TemplateType.LinuxFile.ToString()) { template.PartitionMethod = ddlPartitionMethodLin.Text; } else if (ddlImageType.Text == EnumProfileTemplate.TemplateType.WinPE.ToString()) { template.PartitionMethod = ddlPartitionMethodWin.Text; } template.ForceStandardEfi = chkForceEfi.Checked; template.ForceStandardLegacy = chkForceLegacy.Checked; template.ForceDynamicPartitions = chkDownForceDynamic.Checked; template.RemoveGPT = chkRemoveGpt.Checked; template.SkipShrinkVolumes = chkUpNoShrink.Checked; template.SkipShrinkLvm = chkUpNoShrinkLVM.Checked; template.Compression = ddlCompAlg.Text; template.CompressionLevel = ddlCompLevel.Text; template.UploadSchemaOnly = chkSchemaOnly.Checked; template.SenderArguments = txtSender.Text; template.ReceiverArguments = txtReceiver.Text; template.SkipHibernationCheck = chkSkipHibernation.Checked; template.SkipBitlockerCheck = chkSkipBitlocker.Checked; var result = Call.ImageProfileTemplateApi.Put(template.Id, template); if (result.Success) { EndUserMessage = "Successfully Updated " + template.TemplateType; } else { EndUserMessage = "Could Not Update " + template.TemplateType; } }
public DtoActionResult UpdateTemplate(EntityImageProfileTemplate template) { var actionResult = new DtoActionResult(); var existingTemplate = GetTemplate(template.TemplateType); if (existingTemplate == null) { return new DtoActionResult { ErrorMessage = "Template Not Found", Id = 0 } } ; template.Id = existingTemplate.Id; _uow.ImageProfileTemplateRepository.Update(template, existingTemplate.Id); _uow.Save(); actionResult.Success = true; actionResult.Id = existingTemplate.Id; return(actionResult); } }