public override int GetHashCode() { int hash = 1; if (VersionInfo.Length != 0) { hash ^= VersionInfo.GetHashCode(); } hash ^= resources_.GetHashCode(); if (Canary != false) { hash ^= Canary.GetHashCode(); } if (TypeUrl.Length != 0) { hash ^= TypeUrl.GetHashCode(); } if (Nonce.Length != 0) { hash ^= Nonce.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public async Task <IActionResult> Edit(int id, [Bind("CanaryId,Name,Species,Breeder,Cost,Gender,Sold,Deceased")] Canary canary) { if (id != canary.CanaryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(canary); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CanaryExists(canary.CanaryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(canary)); }
static void Main(string[] args) { Bird bird1 = new Sparrow(); bird1.PerformFly(); bird1.PerformSound(); Bird bird2 = new Duck(); bird2.PerformFly(); bird2.PerformSound(); Bird bird3 = new Canary(); bird3.PerformFly(); bird3.PerformSound(); bird3.SetFlyBehavior(new FlyNoWay()); bird3.SetSoundBehavior(new Mute()); bird3.PerformFly(); bird3.PerformSound(); Bird bird4 = new Penguin(); bird4.PerformFly(); bird4.PerformSound(); Console.WriteLine("End of program"); Console.ReadKey(); }
public async Task <IActionResult> Create([Bind("CanaryId,Name,Species,Breeder,Cost,Gender,Sold,Deceased")] Canary canary) { if (ModelState.IsValid) { _context.Add(canary); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(canary)); }
static void Main(string[] args) { var CanaryId = Environment.GetEnvironmentVariable("CANARY_ID") ?? "default"; var ChirpUrl = Environment.GetEnvironmentVariable("CHIRP_URL"); var Debug = Environment.GetEnvironmentVariable("DEBUG") == "true"; var HeartbeatPeriodSeconds = Environment.GetEnvironmentVariable("CANARY_HEARTBEAT_SEC") ?? "300"; var SquawkUrl = Environment.GetEnvironmentVariable("SQUAWK_URL"); var CanaryOptions = new ZeebeCanaryOptions() { CanaryId = CanaryId, ChirpUrl = ChirpUrl, Debug = Debug, HeartbeatPeriodSeconds = Convert.ToInt16(HeartbeatPeriodSeconds), SquawkUrl = SquawkUrl }; var Canary = new Canary(CanaryOptions); }
protected override Animal createAnimal(string species) { Animal animal = null; IBehaviourFactory parrotBehaviourFactory = new ParrotBehaviourFactory(); IBehaviourFactory canaryBehaviourFactory = new CanaryBehaviourFactory(); switch (species) { case ("Parrot"): animal = new Parrot(parrotBehaviourFactory); break; case ("Canary"): animal = new Canary(canaryBehaviourFactory); break; default: break; } return(animal); }
public async Task <string> Token() { // Retrieve the canary value and authenticate string canary; using (StreamReader reader = new StreamReader(Request.Body)) { canary = reader.ReadToEnd(); } if (string.IsNullOrEmpty(canary)) { throw new Exception("Canary missing"); } if (!Canary.Validate(canary)) { throw new Exception("Authentication failed"); } // Obtain a token using the subscription key return(await GetTokenAsync()); }
public void OnGet() { ViewData["Canary"] = Canary.Generate(); }