Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("FutarId,Nev")] Futar futar)
        {
            if (id != futar.FutarId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(futar);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FutarExists(futar.FutarId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(futar));
        }
        public async Task <IActionResult> Edit(int id, [Bind("MegrendeloId,Nev")] Megrendelo megrendelo)
        {
            if (id != megrendelo.MegrendeloId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(megrendelo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MegrendeloExists(megrendelo.MegrendeloId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(megrendelo));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("CimId,Irsz,Varos,Utca,Hazszam,Csengo,MegrendeloId")] Cim cim)
        {
            if (id != cim.CimId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cim);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CimExists(cim.CimId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MegrendeloId"] = new SelectList(_context.Megrendelok, "MegrendeloId", "Nev", cim.MegrendeloId);
            return(View(cim));
        }
        public async Task <IActionResult> Kiszallit(int id, [Bind("RendelesId,AllapotId,FutarId,CimId")] Rendeles rendeles)
        {
            if (id != rendeles.RendelesId)
            {
                return(NotFound());
            }

            if (rendeles.AllapotId != 1)
            {
                ModelState.AddModelError("Error", "A rendelés nem szállítható ki, mert már kiszállítás alatt áll! ");
                ViewData["AllapotId"] = new SelectList(_context.Allapotok, "AllapotId", "Megnevezes", rendeles.AllapotId);
                PopulateCimDropDownList();
                ViewData["FutarId"] = new SelectList(_context.Futarok, "FutarId", "Nev", rendeles.FutarId);
                return(View(rendeles));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    rendeles.AllapotId = 2;
                    _context.Update(rendeles);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RendelesExists(rendeles.RendelesId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AllapotId"] = new SelectList(_context.Allapotok, "AllapotId", "Megnevezes", rendeles.AllapotId);
            PopulateCimDropDownList();
            ViewData["FutarId"] = new SelectList(_context.Futarok, "FutarId", "Nev", rendeles.FutarId);
            return(View(rendeles));
        }