public IActionResult Edit(int id, [Bind("FuvarID,Feladat,IndulasIdeje,BerakoCim,KirakoCim,SelectedGepjarmu,SelectedSofor")] FuvarCreateViewModel fuvar) { if (ModelState.IsValid) { var actualfuvar = _context.Fuvarok.Find(id); if (actualfuvar == null) { return(NotFound()); } actualfuvar.Feladat = fuvar.Feladat; actualfuvar.BerakoCim = fuvar.BerakoCim; actualfuvar.KirakoCim = fuvar.KirakoCim; actualfuvar.IndulasIdeje = DateTime.Parse(fuvar.IndulasIdeje); actualfuvar.GepjarmuID = int.Parse(fuvar.SelectedGepjarmu); actualfuvar.Gepjarmu = _context.Gepjarmuvek.Find(int.Parse(fuvar.SelectedGepjarmu)); actualfuvar.SoforID = int.Parse(fuvar.SelectedSofor); actualfuvar.Sofor = _context.Soforok.Find(int.Parse(fuvar.SelectedSofor)); try { _context.Update(actualfuvar); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!FuvarExists(actualfuvar.FuvarID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index", "Fuvars")); } fuvar.SoforList = GetSoforok(); fuvar.GepjarmuList = GetGepjarmuvek(); return(View(fuvar)); }
public IActionResult Edit(int id, [Bind("GepjarmuID,Tipus,Rendszam,FutottKm,SzervizCiklus,UtolsoSzerviz,Kategoria,SelectedTelephelyCim")] GepjarmuCreateViewModel gepjarmu) { if (ModelState.IsValid) { var temp = _context.Gepjarmuvek.Find(id); if (temp == null) { return(NotFound()); } temp.Tipus = gepjarmu.Tipus; temp.Rendszam = gepjarmu.Rendszam; temp.Kategoria = gepjarmu.Kategoria; temp.FutottKm = gepjarmu.FutottKm; temp.UtolsoSzerviz = DateTime.Parse(gepjarmu.UtolsoSzerviz); temp.SzervizCiklus = gepjarmu.SzervizCiklus; temp.TelephelyID = int.Parse(gepjarmu.SelectedTelephelyCim); temp.Telephely = _context.Telephelyek.Find(int.Parse(gepjarmu.SelectedTelephelyCim)); try { _context.Update(temp); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GepjarmuExists(gepjarmu.GepjarmuID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index", "Gepjarmus")); } gepjarmu.Telephelyek = GetTelephelyek(); return(View(gepjarmu)); }
public IActionResult Edit(int id, SoforCreateViewModel sofor) { if (id != sofor.SoforID) { return(NotFound()); } if (ModelState.IsValid) { Sofor soformodel = new Sofor { Csaladnev = sofor.Csaladnev, Keresztnev = sofor.Keresztnev, SzulIdo = DateTime.Parse(sofor.SzulIdo), JogositvanySzam = sofor.JogositvanySzam, Ervenyesseg = DateTime.Parse(sofor.Ervenyesseg), Kategoria = sofor.Kategoria }; try { _context.Update(soformodel); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SoforExists(soformodel.SoforID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index", "Sofors")); } return(View(sofor)); }