Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to save contentItem when using "contentItem.As<LeadPart>()" in OrchardCore 2.1.3 without exceptions #17265

Closed
effapp opened this issue Dec 20, 2024 · 1 comment
Labels

Comments

@effapp
Copy link

effapp commented Dec 20, 2024

Describe the bug

Failed to save contentItem when using "contentItem.As()" in OrchardCore 2.1.3 without exceptions

var contentItem = await _contentManager.NewAsync("Lead");
var leadPart = contentItem.As<LeadPart>();
leadPart.FirstName =FirstName;
leadPart.LastName =LastName;
leadPart.Company =Company;
leadPart.Email =Email;
leadPart.Phone =Phone;
leadPart.Source =Source;
leadPart.Status =Status;
leadPart.Description =Description;
leadPart.Apply();
await _contentManager.CreateAsync(contentItem, VersionOptions.Published);

The result saved to database is :

{"ContentItemId":"4we05tthw9aq15k3tt4m78j9ds","ContentItemVersionId":"4nyw8p39pywx01t6cb8kzdxz4a","ContentType":"Lead","DisplayText":"3333333333333","Latest":true,"Published":true,"ModifiedUtc":"2024-12-20T07:45:14.542097Z","PublishedUtc":"2024-12-20T07:45:14.6086407Z","CreatedUtc":"2024-12-20T07:45:14.542097Z","Owner":"431atmty3vvgf4jbc3v4qhx4cp","Author":"superadmin","TitlePart":{},"LeadPart":{"FirstName":{},"LastName":{},"Company":{},"Email":{},"Phone":{},"Source":{},"Status":{},"Description":{},"Id":null,"CreatedUtc":"2024-12-20T07:43:58Z","LastModifiedUtc":"2024-12-20T07:44:00Z"}}

The modifications made to the leadPart have not taken effect . What's the problem, please?

Orchard Core version

version 2.1.3

@effapp
Copy link
Author

effapp commented Dec 20, 2024

public class LeadPart : ContentPart
{
public string? Id { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public string? Company { get; set; }
public string? Email { get; set; }
public string? Phone { get; set; }

public string? Source { get; set; }

public string? Status { get; set; }

public string? Description { get; set; }

public DateTime? CreatedUtc { get; set; }

public DateTime? LastModifiedUtc { get; set; }

}

@OrchardCMS OrchardCMS locked and limited conversation to collaborators Dec 21, 2024
@Piedone Piedone converted this issue into discussion #17270 Dec 21, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

1 participant