public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Produs = await _context.Produs .Include(b => b.Furnizor) .Include(b => b.CategoriiProduse).ThenInclude(b => b.Categorie) .AsNoTracking() .FirstOrDefaultAsync(m => m.ID == id); //Produs = await _context.Produs.FirstOrDefaultAsync(m => m.ID == id); if (Produs == null) { return(NotFound()); } //apelam PopulateAssignedCategoryData pentru o obtine informatiile necesare checkbox- //urilor folosind clasa AssignedCategoryData PopulateAssignedCategoryData(_context, Produs); ViewData["FurnizorID"] = new SelectList(_context.Set <Furnizor>(), "ID", "NumeFurnizor"); return(Page()); }
public IActionResult OnGet() { ViewData["FurnizorID"] = new SelectList(_context.Set <Furnizor>(), "ID", "NumeFurnizor"); var produs = new Produs(); produs.CategoriiProduse = new List <CategorieProdus>(); PopulateAssignedCategoryData(_context, produs); return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Produs = await _context.Produs .Include(b => b.Furnizor) .Include(b => b.CategoriiProduse).ThenInclude(b => b.Categorie) .AsNoTracking() .FirstOrDefaultAsync(m => m.ID == id); if (Produs == null) { return(NotFound()); } PopulateAssignedCategoryData(_context, Produs); ViewData["FurnizorID"] = new SelectList(_context.Set <Furnizor>(), "ID", "NumeFurnizor"); return(Page()); }