Exemplo n.º 1
0
        public async Task <IActionResult> Edit(long id, [Bind("KodRiska,Naimenovanie,Opisanie,SrednyayaVeroyatnost")] Riski riski)
        {
            if (id != riski.KodRiska)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(riski);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RiskiExists(riski.KodRiska))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(riski));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("KodRiska,Naimenovanie,Opisanie,SrednyayaVeroyatnost")] Riski riski)
        {
            if (ModelState.IsValid)
            {
                _context.Add(riski);
                await _context.SaveChangesAsync();

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