Ejemplo n.º 1
0
        public async Task <IActionResult> PutTest(int id, Test test)
        {
            if (id != test.TestId)
            {
                return(BadRequest());
            }

            var listeTests = await _context.Test.Include(s => s.Steps).ToListAsync();

            var testToUpdate = listeTests.Find(t => t.TestId == id);

            testToUpdate.TestName        = test.TestName;
            testToUpdate.TestDescription = test.TestDescription;
            testToUpdate.TestName        = test.TestName;
            testToUpdate.CircuitName     = test.CircuitName;
            testToUpdate.CircuitId       = test.CircuitId;
            testToUpdate.Environment     = test.Environment;
            testToUpdate.Steps           = test.Steps;
            testToUpdate.Published       = test.Published;

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

            return(NoContent());
        }