using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; using CertAuth.Data; using CertAuth.Domain; using Microsoft.VisualStudio.Web.CodeGeneration.Contracts.Messaging; using Microsoft.Identity.Client; namespace CertAuthAdmin.Pages.Items { public class ItemsPhotoAddModel : PageModel { private readonly CertAuth.Data.CertAuthContext _context; public ItemsPhotoAddModel(CertAuth.Data.CertAuthContext context) { _context = context; } [BindProperty] public CertAuth.Domain.Items Items { get; set; } [BindProperty(Name = "editID", SupportsGet = true)] public int editID { get; set; } public async Task OnGetAsync(int? id) { if (id == null && editID != 0) { id = editID; } Items = await _context.Items.FirstOrDefaultAsync(m => m.Id == id); return Page(); } //public void OnGet() //{ //} } }