Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,SomeName")] Repo2Item repo2Item)
        {
            if (id != repo2Item.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(repo2Item);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Repo2ItemExists(repo2Item.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(repo2Item));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,SomeName")] Repo2Item repo2Item)
        {
            if (ModelState.IsValid)
            {
                _context.Add(repo2Item);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(repo2Item));
        }
Exemplo n.º 3
0
 public void Add(Repo2Item repo2Item)
 {
     _context.Repo2Items.Add(repo2Item);
 }