Hello,
I have a Module created with the ModuleBuilder called Bill. I want to create new bill items from the front end.
Here's my code :
public static Bill createBill(User custommer, Product product)
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
Type billType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Bill.Bill");
DynamicContent billItem = dynamicModuleManager.CreateDataItem(billType, Guid.NewGuid(), "/ModuleBuilder");
billItem.SetValue("Title", "Some Title" );
billItem.SetValue("Owner", SecurityManager.GetCurrentUserId());
billItem.SetValue("custommerId", custommer.Id.ToString());
billItem.SetValue("PublicationDate", DateTime.Now);
billItem.SetValue("productId", product.Id.ToString());
billItem.SetValue("duration", product.selectedDuration);
billItem.SetValue("billStatus", "pending");
billItem.SetValue("purchaseDate", null);
billItem.SetValue("validityLimitDate", null);
billItem.SetValue("activationDate", null);
billItem.SetValue("price", product.price);
billItem.Status = Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master;
billItem.Visible = true;
dynamicModuleManager.Lifecycle.Publish(billItem);
dynamicModuleManager.SaveChanges();
var test = dynamicModuleManager.GetDataItems(billType).Where(p => p.Id == billItem.Id && p.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master);
return new Bill(billItem);
My item is created in the database table "bill" but does not appear in the backend Bill page. Moreover test return no DataItem.
Do I miss a step ?