Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Code,Name")] PasOtdel pasOtdel)
        {
            if (id != pasOtdel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pasOtdel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PasOtdelExists(pasOtdel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pasOtdel));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id,Code,Name")] PasOtdel pasOtdel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pasOtdel);
                await _context.SaveChangesAsync();

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