I have created this sample controller to demonstrate the issue.
After running this the output is: new title = old
Showing that the title is not updated.
The output should be new title = Edited Title
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Core.Services;
public class TestController : ControllerBase
{
private IContentService _contentService;
public TestController(IContentService contentService)
{
_contentService = contentService;
}
public IContentService ContentService { get; }
[Route("/test")]
public IActionResult Test()
{
//edit homepage title
var content = _contentService.GetById(new Guid("4babb907-cc10-4456-bc45-d12cf9a754aa"));
content.SetValue("title", "Edited Title");
_contentService.Publish(content, ["*"]);
var updatedContent = _contentService.GetById(new Guid("4babb907-cc10-4456-bc45-d12cf9a754aa"));
return Ok("new title = " + updatedContent.GetValue("title"));
}
}