public bool UpdateLink(LinkDetails link) { using (var context = new RelayContext()) { var linkEntity = context.Links.SingleOrDefault(p => p.Id == link.Id); if (linkEntity == null) { return(false); } linkEntity.CreationDate = link.CreationDate; linkEntity.AllowLocalClientRequestsOnly = link.AllowLocalClientRequestsOnly; linkEntity.ForwardOnPremiseTargetErrorResponse = link.ForwardOnPremiseTargetErrorResponse; linkEntity.IsDisabled = link.IsDisabled; linkEntity.MaximumLinks = link.MaximumLinks; linkEntity.SymbolicName = link.SymbolicName; linkEntity.UserName = link.UserName; linkEntity.TokenRefreshWindow = link.TokenRefreshWindow; linkEntity.HeartbeatInterval = link.HeartbeatInterval; linkEntity.ReconnectMinWaitTime = link.ReconnectMinWaitTime; linkEntity.ReconnectMaxWaitTime = link.ReconnectMaxWaitTime; linkEntity.AbsoluteConnectionLifetime = link.AbsoluteConnectionLifetime; linkEntity.SlidingConnectionLifetime = link.SlidingConnectionLifetime; context.Entry(linkEntity).State = EntityState.Modified; return(context.SaveChanges() == 1); } }