public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } Servis.ServisStavka = servisStavka.FindById(ServisStavka); Servis.Vozilo = voziloRepo.FindById(Vozilo); try { servrepo.Update(Servis); } catch (DbUpdateConcurrencyException) { if (!ServisExists(Servis.IDServis)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public IActionResult OnPost() { Servis.Vozilo = voziloRepo.FindById(Vozilo); Servis.ServisStavka = servisStavka.FindById(ServisStavka); if (!ModelState.IsValid) { return(Page()); } servrepo.Create(Servis); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { PutniNalog.Vozilo = voziloRepo.FindById(Vozilo); PutniNalog.Vozac = vozacRepo.FindById(Vozac); if (!repo.FindBetweenDates(PutniNalog.StartDate, PutniNalog.StopDate).Any()) { if (!ModelState.IsValid) { return(Page()); } repo.Create(PutniNalog); return(RedirectToPage("./Index")); } else { return(RedirectToPage("./VoziloZauzeto")); } }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } //_context.Attach(Vozac).State = EntityState.Modified; try { PutniNalog.Vozilo = voziloRepo.FindById(Vozilo); PutniNalog.Vozac = vozacRepo.FindById(Vozac); if (!repo.FindBetweenDates(PutniNalog.StartDate, PutniNalog.StopDate).Any(x => x.IDPutniNalog != PutniNalog.IDPutniNalog)) { repo.Update(PutniNalog); return(RedirectToPage("./Index")); } else { return(RedirectToPage("./VoziloZauzeto")); } } catch (SqlException) { if (!PutniNalogExists(PutniNalog.IDPutniNalog)) { return(NotFound()); } else { throw; } } }