public async Task <IActionResult> Edit(int id, [Bind("Id,SomeNumber")] Repo1Item repo1Item)
        {
            if (id != repo1Item.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(repo1Item);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Repo1ItemExists(repo1Item.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(repo1Item));
        }
        public async Task <IActionResult> Create([Bind("Id,SomeNumber")] Repo1Item repo1Item)
        {
            if (ModelState.IsValid)
            {
                _context.Add(repo1Item);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(repo1Item));
        }
示例#3
0
 public void Add(Repo1Item repo1Item)
 {
     _context.Repo1Items.Add(repo1Item);
 }