public void StoreStatusOf(SimulatorKey key, string ipAddress, bool isEnabled)
 {
     if (isEnabled)
     {
         _simulatorsStatus.Add(new SimulatorStatus { IpAddress = ipAddress, Key = key });
     }
     else
     {
         _simulatorsStatus.RemoveAll(x => x.IpAddress == ipAddress && x.Key == key);
     }
 }
Ejemplo n.º 2
0
 public IActionResult Change(SimulatorKey simulatorKey, bool value)
 {
     _simulatorDecider.ChangeSimulatorTo(simulatorKey, value);
     return RedirectToAction("Index");
 }
Ejemplo n.º 3
0
 public bool ShouldSimulate(SimulatorKey key)
 {
     var cookie = _context.HttpContext.Request.Cookies[key.ToString()];
     return cookie != null && bool.Parse(cookie);
 }
Ejemplo n.º 4
0
 public void ChangeSimulatorTo(SimulatorKey key, bool value)
 {
     _context.HttpContext.Response.Cookies.Append(key.ToString(), value.ToString(), new CookieOptions { Expires = DateTimeOffset.MaxValue });
 }
 public bool StatusFor(SimulatorKey key, string ipAddress)
 {
     return _simulatorsStatus.Any(x => x.IpAddress == ipAddress && x.Key == key);
 }
Ejemplo n.º 6
0
 public bool ShouldSimulate(SimulatorKey key)
 {
     return _simulatorStatusStorage.StatusFor(key, _httpContext.CurrentIpAddress());
 }
Ejemplo n.º 7
0
 public void ChangeSimulatorTo(SimulatorKey key, bool isEnabled)
 {
     _simulatorStatusStorage.StoreStatusOf(key, _httpContext.CurrentIpAddress(), isEnabled);
 }