Newer
Older
SimplePossibleThing / CQRSRazorPages / Pages / Add.cshtml.cs
@Derek Comartin Derek Comartin on 16 Nov 2021 405 bytes Init
using CQRSGui;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using SimpleCQRS;

namespace CQRSRazorPages.Pages;

public class Add : PageModel
{
    public IActionResult OnPost(string name)
    {
        var id = Guid.NewGuid();
        ServiceLocator.MessageDispatcher.Send(new CreateInventoryItem(id, name));
        return RedirectToPage("/Details", new { id = id});
    }
}