public async Task <IActionResult> PutSynchronizationStep([FromRoute] int id, [FromBody] SynchronizationStep synchronizationStep) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != synchronizationStep.Id) { return(BadRequest()); } synchronizationStep.UpdatedAt = DateTimeOffset.Now; _context.Entry(synchronizationStep).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SynchronizationStepExists(id)) { return(NotFound()); } else { throw; } } return(Ok(_context.SynchronizationSteps.Find(id))); }
public async Task <IActionResult> PostSynchronizationStep([FromBody] SynchronizationStep synchronizationStep) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var now = DateTimeOffset.Now; synchronizationStep.CreatedAt = now; synchronizationStep.UpdatedAt = now; _context.SynchronizationSteps.Add(synchronizationStep); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSynchronizationStep", new { id = synchronizationStep.Id }, synchronizationStep)); }