Example #1
0
 public void Update(int id, Artwork obj)
 {
     try
     {
         _context.Update(obj);
         _context.SaveChanges();
     }
     catch (DbUpdateConcurrencyException e)
     {
         throw new DbConcurrencyException(e.Message);
     }
 }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Team team)
        {
            if (id != team.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(team);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeamExists(team.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(team));
        }