Пример #1
0
        //[Route("id")]
        public async Task <IActionResult> PutEmployee(int id, Employee employee)
        {
            if (id != employee.Id)
            {
                return(BadRequest());
            }

            _context.Entry(employee).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #2
0
 public TestTable UpdateTestTable(TestTable testtable)
 {
     testApiDbContext.Entry(testtable).State = EntityState.Modified;
     testApiDbContext.SaveChanges();
     return(testtable);
 }