Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("OsobaId,Ime,Prezime,Adresa")] Osoba osoba)
        {
            if (id != osoba.OsobaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(osoba);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OsobaExists(osoba.OsobaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(osoba));
        }
Exemplo n.º 2
0
        public IActionResult Edit(int id, [Bind("OsobaId,Ime,Prezime,Telefon")] Osoba osoba)
        {
            if (id != osoba.OsobaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    db.Update(osoba);
                    db.SaveChanges();
                    return(RedirectToAction(nameof(Index)));
                }
                catch (Exception)
                {
                    ViewBag.Greska = "Greska pri promjeni";
                    return(View(osoba));
                }
            }
            return(View(osoba));
        }