public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                _logger.LogError("Error occured while watching detailed at a LKW");
                return(NotFound());
            }

            LKW = await _context.LKW.FirstOrDefaultAsync(m => m.ID == id);

            if (LKW == null)
            {
                _logger.LogError("Error occured while watching detailed at a LKW");
                return(NotFound());
            }

            if (User.Identity.Name == null)
            {
                _logger.LogInformation("Not Logged or Registrated user looked at detailed LKW {0}", LKW.ID);
            }
            else
            {
                _logger.LogInformation("{0} looked at detailed LKW {1}", User.Identity.Name, LKW.ID);
            }

            return(Page());
        }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     LKW lkw_Nr_1 = new LKW(4, 13000.0);
     LKW lkw_Nr_2 = new LKW(4, 13000.0);
     LKW lkw_Nr_3 = new LKW(4, 13000.0);
     LKW lkw_Nr_4 = new LKW(4, 13000.0);
     LKW lkw_Nr_5 = new LKW(4, 13000.0);
 }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                _logger.LogError("LKW is not found and can be deleted");
                return(NotFound());
            }

            LKW = await _context.LKW.FirstOrDefaultAsync(m => m.ID == id);

            if (LKW == null)
            {
                _logger.LogError("LKW is not found and can be deleted");
                return(NotFound());
            }
            return(Page());
        }
        private static void TPT()
        {
            using (var context = new InheritanceContext())
            {
                var lkw = new LKW {
                    Farbe = "Rot", MaxLadung = 13000
                };
                var pkw = new PKW {
                    Farbe = "Blau", Sitzplaetze = 5
                };

                context.Fahrzeuge.Add(lkw);
                context.Fahrzeuge.Add(pkw);

                context.SaveChanges();
            }
        }
Exemplo n.º 5
0
        private static void TPT()
        {
            using (var context = new InheritanceContext())
            {
                var pkw = new PKW {
                    Geschwindigkeit = 50, Sitzplätze = 5
                };
                var lkw = new LKW {
                    Geschwindigkeit = 30, MaxLadung = 18000
                };

                context.Fahrzeuge.Add(pkw);
                context.Fahrzeuge.Add(lkw);

                context.SaveChanges();
            }
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                _logger.LogError("LKW is not found and can be deleted");
                return(NotFound());
            }

            LKW = await _context.LKW.FindAsync(id);

            if (LKW != null)
            {
                _context.LKW.Remove(LKW);
                await _context.SaveChangesAsync();

                _logger.LogDebug("LKW is Deleted by User {0}", User.Identity.Name);
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                _logger.LogError("Error Fahrzeug not found");
                return(NotFound());
            }

            LKW = await _context.LKW.FirstOrDefaultAsync(m => m.ID == id);

            if (LKW == null)
            {
                _logger.LogError("Error Fahrzeug not found");
                return(NotFound());
            }

            _logger.LogInformation("User {0} is changing LKW {1}", User.Identity.Name, LKW.ID);

            return(Page());
        }
Exemplo n.º 8
0
 private void Awake()
 {
     lkw = GameObject.FindObjectOfType <LKW>();
 }