using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.EntityFrameworkCore; using CertAuth.Data; using CertAuth.Domain; namespace CertAuthAdmin.Pages.CollectorItemsList { public class CollectorItems_ListModel : PageModel { private readonly CertAuth.Data.CertAuthContext _context; private readonly Models.CollectorItemsDA ClctrItmsDA; private readonly Controllers.CollectorsController Clctr; public CollectorItems_ListModel(CertAuth.Data.CertAuthContext context) { _context = context; ClctrItmsDA = new Models.CollectorItemsDA(); Clctr = new Controllers.CollectorsController(_context); } [BindProperty] public IList CollectorItemsList { get;set; } [BindProperty(Name = "editID", SupportsGet = true)] public int editID { get; set; } public async Task OnGetAsync(int id) { if (id == 0 && editID != 0) { id = editID; } //CollectorItemsList = await _context.CollectorItemsList.ToListAsync(); //CollectorItemsList = ClctrItmsDA.GetItem(id).ToList(); CollectorItemsList = Clctr.GetItem(id).ToList(); } } }