Exemple #1
0
        public IActionResult OnGet()
        {
            ViewData["ProducatorID"] = new SelectList(_context.Set <Producator>(), "ID", "NumeProducator");
            var telefon = new Telefon();

            telefon.TelefonCategories = new List <TelefonCategory>();
            PopulateAssignedCategoryData(_context, telefon);
            return(Page());
        }
Exemple #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Telefon = await _context.Telefon
                      .Include(b => b.Producator)
                      .Include(b => b.TelefonCategories).ThenInclude(b => b.Category)
                      .AsNoTracking()
                      .FirstOrDefaultAsync(m => m.ID == id);

            if (Telefon == null)
            {
                return(NotFound());
            }

            PopulateAssignedCategoryData(_context, Telefon);

            ViewData["ProducatorID"] = new SelectList(_context.Set <Producator>(), "ID", "NumeProducator");
            return(Page());
        }