19 lines
848 B
C#
19 lines
848 B
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Htmx.ApiDemo.Templates;
|
|
|
|
public sealed class Greeting : GreetingBase
|
|
{
|
|
private byte[] _userData = [];
|
|
private byte[] _countData = [];
|
|
private byte[] _greetingIdData = [];
|
|
public required string Username { init => _userData = value.ToUtf8Bytes(); }
|
|
public required int Count { init => _countData = $"{value}".ToUtf8Bytes(); }
|
|
public required Guid GreetingId { init => _greetingIdData = $"{value}".ToUtf8Bytes(); }
|
|
|
|
protected override void RenderCount(HtmxRenderContext context) => context.Writer.WriteUtf8(_countData);
|
|
protected override void RenderGreetingId(HtmxRenderContext context) => context.Writer.WriteUtf8(_greetingIdData);
|
|
protected override void RenderUser(HtmxRenderContext context) => context.Writer.WriteUtf8(_userData);
|
|
}
|