using Microsoft.AspNetCore.Mvc.RazorPages;

namespace MyWebApp.Pages;

public class PokeyModel : PageModel
{
    public string? Message { get; set; }
    public string? Image { get; set; }
    
    public void OnGet()
    {
        ViewData["Message"] += $" Backend server time is { DateTime.Now }";
        ViewData["Image"] += "assets/pokey.webp";
    }
    
    public void OnPost()
    {
        ViewData["Message"] += $" Backend server time is { DateTime.Now }";
        Message = "Form Posted";
    }
    public void OnPostDelete(int id)
    {
        ViewData["Message"] += $" Backend server time is { DateTime.Now }";
        Message = $"Delete handler ID: {id}";
        ViewData["Image"] += "assets/image-missing.jpg";
    }
    public void OnPostEdit(int id)
    {
        ViewData["Message"] += $" Backend server time is { DateTime.Now }";
        Message = $"Edit handler ID: {id}";
        ViewData["Image"] += "assets/pokey2.webp";
    }
    public void OnPostView(int id)
    {
        ViewData["Message"] += $" Backend server time is { DateTime.Now }";
        Message = $"View handler ID: {id}";
        ViewData["Image"] += "assets/pokey-where.gif";
    }
}