Exemplo n.º 1
0
 public List <TenantDto> InsertExampleData()
 {
     using (TransactionScope scope = new TransactionScope())
     {
         var entities = new List <Tenant>()
         {
             new Tenant()
             {
                 Name = "Tenant A"
             },
             new Tenant()
             {
                 Name = "Tenant B"
             },
             new Tenant()
             {
                 Name = "Tenant C"
             },
         };
         dbContext.AddRange(entities);
         dbContext.SaveChanges();
         dynamicFormService.SaveAttribute(new DynamicForm.Dto.FormAttributeEditDto()
         {
             ControlType  = Core.DynamicForm.FormAttributeControlType.RadioButtonList,
             DisplayOrder = 10,
             Name         = "Test",
             Required     = true,
             TenantId     = entities.First().Id,
             FormAttributeValueEditDtos = new List <DynamicForm.Dto.FormAttributeValueEditDto> {
                 new DynamicForm.Dto.FormAttributeValueEditDto()
                 {
                     DisplayOrder = 10,
                     Name         = "a",
                 },
                 new DynamicForm.Dto.FormAttributeValueEditDto()
                 {
                     DisplayOrder = 20,
                     Name         = "b",
                 },
                 new DynamicForm.Dto.FormAttributeValueEditDto()
                 {
                     DisplayOrder = 30,
                     Name         = "c",
                 }
             }
         });
         dynamicFormService.SaveAttribute(new DynamicForm.Dto.FormAttributeEditDto()
         {
             ControlType  = Core.DynamicForm.FormAttributeControlType.DropDownList,
             DisplayOrder = 20,
             Name         = "City",
             Required     = true,
             TenantId     = entities.First().Id,
             FormAttributeValueEditDtos = new List <DynamicForm.Dto.FormAttributeValueEditDto> {
                 new DynamicForm.Dto.FormAttributeValueEditDto()
                 {
                     DisplayOrder = 10,
                     Name         = "北京",
                 },
                 new DynamicForm.Dto.FormAttributeValueEditDto()
                 {
                     DisplayOrder = 20,
                     Name         = "上海",
                 },
                 new DynamicForm.Dto.FormAttributeValueEditDto()
                 {
                     DisplayOrder = 30,
                     Name         = "深圳",
                 }
             }
         });
         dynamicFormService.SaveAttribute(new DynamicForm.Dto.FormAttributeEditDto()
         {
             ControlType  = Core.DynamicForm.FormAttributeControlType.TextBox,
             DisplayOrder = 30,
             Name         = "Detail address",
             Required     = true,
             TenantId     = entities.First().Id,
         });
         scope.Complete();
         return(entities.Select(s => new TenantDto()
         {
             Id = s.Id, Name = s.Name
         }).ToList());
     }
 }
Exemplo n.º 2
0
 public IActionResult EditFormAttribute(FormAttributeEditDto data)
 {
     data.TenantId = TenantId;
     dynamicFormService.SaveAttribute(data);
     return(View(data));
 }