public IActionResult Put(string connectionId, [FromBody] CreateConnectionViewModel model) { var provider = _providers.FirstOrDefault(p => p.Id == model.ProviderId); if (provider == null) { return(NotFound("The requested provider is not found.")); } try { var result = _connectionRepository.Update <ConnectionModel>(connectionId, new { model.Name, model.Description, model.ProviderId }); _connectionRepository.LinkOptions(connectionId, model.Options); _transaction.Commit(); return(Ok(result)); } catch { _transaction.Rollback(); throw; } }
public void ForceServerUpdatesReload() { try { // corrupted state. Refresh all updates: var con = _connection ?? _connectionRepo.GetConnection(); if (con != null) { con.LastUpdated = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); _connectionRepo.Update(con); _context.SaveChanges(); } } catch (Exception ex) { Logger.WriteException(ex, "Cannot reset Last Updated server date."); } }