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));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("IdRoba,SifraProizvoda,Status,Tezina,DatumIsporuke")] Roba20191220 roba20191220)
        {
            if (ModelState.IsValid)
            {
                _context.Add(roba20191220);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(roba20191220));
        }
        public async Task <IActionResult> Create([Bind("Id,IdRoba,Napomena")] Robanapomene20191220 robanapomene20191220)
        {
            if (ModelState.IsValid)
            {
                _context.Add(robanapomene20191220);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdRoba"] = new SelectList(_context.Roba20191220, "IdRoba", "IdRoba", robanapomene20191220.IdRoba);
            return(View(robanapomene20191220));
        }