Пример #1
0
        public async Task <IActionResult> Edit(int robaId, int napomenaId, Test test)
        {
            if (robaId != test.Roba.IdRoba || napomenaId != test.Napomena.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var roba     = _context.Roba20191220.Find(robaId);
                    var napomena = _context.Robanapomene20191220.Find(napomenaId);

                    roba.SifraProizvoda = test.Roba.SifraProizvoda;
                    roba.Status         = test.Roba.Status;
                    roba.Tezina         = test.Roba.Tezina;
                    roba.DatumIsporuke  = test.Roba.DatumIsporuke;

                    napomena.Napomena = test.Napomena.Napomena;

                    _context.Update(roba);
                    _context.Update(napomena);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    throw;
                }
                return(RedirectToAction("Index", "Binding"));
            }
            return(View(test));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("IdRoba,SifraProizvoda,Status,Tezina,DatumIsporuke")] Roba20191220 roba20191220)
        {
            if (id != roba20191220.IdRoba)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(roba20191220);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Roba20191220Exists(roba20191220.IdRoba))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(roba20191220));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,IdRoba,Napomena")] Robanapomene20191220 robanapomene20191220)
        {
            if (id != robanapomene20191220.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(robanapomene20191220);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Robanapomene20191220Exists(robanapomene20191220.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdRoba"] = new SelectList(_context.Roba20191220, "IdRoba", "IdRoba", robanapomene20191220.IdRoba);
            return(View(robanapomene20191220));
        }