Example #1
0
        public IActionResult OnGet()
        {
            LocationId = new SelectList(_context.Locations, "LocationID", "LocationID");
            MotherId   = new SelectList(_context.Vydras, "TattooID", "Name");
            PlaceName  = new SelectList(_context.Places, "Name", "Name");
            founderID  = new SelectList(_context.Set <IdentityUser>(), "Id", "Id");

            PlaceNames = new List <SelectListItem>();
            foreach (var item in _context.Places.Include(l => l.Location).AsEnumerable <Place>())
            {
                PlaceNames
                .Add(new SelectListItem($"{item.Name} ({item.Location.Name})",
                                        $"{item.LocationId};{item.Name}"));
            }

            return(Page());
        }
Example #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Vydra = await _context.Vydras
                    .Include(v => v.Location)
                    .Include(v => v.Mother)
                    .Include(v => v.Place)
                    .Include(v => v.founder).AsNoTracking().FirstOrDefaultAsync(m => m.TattooID == id);


            if (Vydra == null)
            {
                return(NotFound());
            }
            LocationId = new SelectList(_context.Locations, "LocationID", "LocationID");
            MotherId   = new SelectList(_context.Vydras, "TattooID", "Name");
            PlaceName  = new SelectList(_context.Places, "Name", "Name");
            founderID  = new SelectList(_context.Set <IdentityUser>(), "Id", "Id");
            return(Page());
        }