コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,NroInterno,Usuario,Celular")] InternosEntity internosEntity)
        {
            if (id != internosEntity.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(internosEntity);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InternosEntityExists(internosEntity.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(internosEntity));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,NroInterno,Usuario,Celular")] InternosEntity internosEntity)
        {
            if (ModelState.IsValid)
            {
                _context.Add(internosEntity);
                await _context.SaveChangesAsync();

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