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

            PutniNalog = repo.FindAll().FirstOrDefault(m => m.IDPutniNalog == id);
            Vozaci     = vozacRepo.FindAll().Select(x => new SelectListItem
            {
                Value = x.IDVozac.ToString(),
                Text  = $"{x.Ime} {x.Prezime}"
            }).ToList();
            Vozila = voziloRepo.FindAll().Select(x => new SelectListItem
            {
                Value = x.IDVozilo.ToString(),
                Text  = $"{x.Tip} {x.Marka}"
            }).ToList();
            Vozac  = PutniNalog.Vozac.IDVozac;
            Vozilo = PutniNalog.Vozilo.IDVozilo;
            if (PutniNalog == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }



            if (Vozac != null)
            {
                if (!putniRepo.FindAll().Any(x => x.Vozac.IDVozac == Vozac.IDVozac))
                {
                    repo.Delete(Vozac);
                }
                else
                {
                }
            }

            return(RedirectToPage("./Index"));
        }
Пример #3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            PutniNalog = repo.FindAll().FirstOrDefault(m => m.IDPutniNalog == id);

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

            PutniNalog = repo.FindAll().FirstOrDefault(m => m.IDPutniNalog == id);
            /*await _context.Vozaci.FirstOrDefaultAsync(m => m.IDVozac == id);*/

            if (PutniNalog == null)
            {
                return(NotFound());
            }
            return(Page());
        }
 public void OnPost()
 {
     repo.InsertTestCase();
     PutniNalog = repo.FindAll().ToList();
 }