public static void SetAgentAutoBid(string slackUser, int amount, SlackClient agentClient) { lock (ServiceLock) { using (var db = new SlackLeadsBidderContext()) { var agent = db.Agents.FirstOrDefault(e => e.SlackId == slackUser); if (agent == null) { agentClient.PostError($"No agent configured for '{slackUser}'"); return; } agent.AutoBid = amount; db.SaveChanges(); agentClient.PostOk($"You autobid is set to {amount} for next auction."); } } }