コード例 #1
0
 public IActionResult Create(SoforCreateViewModel sofor)
 {
     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
         };
         _context.Add(soformodel);
         _context.SaveChanges();
         return(RedirectToAction("Index", "Sofors"));
     }
     return(View(sofor));
 }
コード例 #2
0
 public IActionResult Create(GepjarmuCreateViewModel gepjarmu)
 {
     if (ModelState.IsValid)
     {
         Gepjarmu temp = new Gepjarmu
         {
             Tipus         = gepjarmu.Tipus,
             Rendszam      = gepjarmu.Rendszam,
             FutottKm      = gepjarmu.FutottKm,
             Kategoria     = gepjarmu.Kategoria,
             SzervizCiklus = gepjarmu.SzervizCiklus,
             UtolsoSzerviz = DateTime.Parse(gepjarmu.UtolsoSzerviz),
             TelephelyID   = int.Parse(gepjarmu.SelectedTelephelyCim),
             Telephely     = _context.Telephelyek.Find(int.Parse(gepjarmu.SelectedTelephelyCim))
         };
         _context.Gepjarmuvek.Add(temp);
         _context.SaveChanges();
         return(RedirectToAction("Index", "Gepjarmus"));
     }
     gepjarmu.Telephelyek = GetTelephelyek();
     return(View(gepjarmu));
 }
コード例 #3
0
 public IActionResult Create(FuvarCreateViewModel ujfuvar)
 {
     if (ModelState.IsValid)
     {
         Fuvar temp = new Fuvar
         {
             Feladat      = ujfuvar.Feladat,
             BerakoCim    = ujfuvar.BerakoCim,
             KirakoCim    = ujfuvar.KirakoCim,
             IndulasIdeje = DateTime.Parse(ujfuvar.IndulasIdeje),
             GepjarmuID   = int.Parse(ujfuvar.SelectedGepjarmu),
             Gepjarmu     = _context.Gepjarmuvek.Find(int.Parse(ujfuvar.SelectedGepjarmu)),
             SoforID      = int.Parse(ujfuvar.SelectedSofor),
             Sofor        = _context.Soforok.Find(int.Parse(ujfuvar.SelectedSofor))
         };
         _context.Fuvarok.Add(temp);
         _context.SaveChanges();
         return(RedirectToAction("Index", "Fuvars"));
     }
     ujfuvar.GepjarmuList = GetGepjarmuvek();
     ujfuvar.SoforList    = GetSoforok();
     return(View(ujfuvar));
 }