public Model.CustomerApiKey GetCustomerApiKeyById(int id) { CustomerApiKey customerApiKey = _context.CustomerApiKey.SingleOrDefault(x => id.Equals(x.Id)); Model.CustomerApiKey customerApiKeyModel = customerApiKey?.MapFull(); return(customerApiKeyModel); }
public int ToggleLock(int id, bool isLocked, string lockedUntil) { CustomerApiKey customerApiKey = _context.CustomerApiKey.SingleOrDefault(x => x.Id.Equals(id)); if (customerApiKey == null) { throw new ArgumentException($"No data found with id: {id}"); } customerApiKey?.MapFull(isLocked, lockedUntil); _context.Save(); return(customerApiKey.Id); }