示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Naziv")] VrstaRobe vrstaRobe)
        {
            if (id != vrstaRobe.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vrstaRobe);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VrstaRobeExists(vrstaRobe.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vrstaRobe));
        }
示例#2
0
 public Roba(VrstaRobe vrsta, double cijena, string naziv, string opis)
 {
     this.vrsta  = vrsta;
     this.cijena = cijena;
     this.naziv  = naziv;
     this.opis   = opis;
 }
示例#3
0
        public async Task <IActionResult> Create([Bind("Id,Naziv")] VrstaRobe vrstaRobe)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vrstaRobe);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vrstaRobe));
        }