/// <summary> /// Create new HiLo instance in database /// </summary> /// <param name="hl"></param> /// <returns></returns> public void CreateHiLoInstance(HiLo hl, out bool isKeyExist) { isKeyExist = false; using (var hlService = new HiLoService <HiLo>(this._dbFactory.CreateDbContext())) { isKeyExist = hlService.GetAll().Any(x => x.Key.Equals(hl.Key)); if (!isKeyExist) { hlService.Add(hl); } else { isKeyExist = true; } } }
public async Task <HttpResponseMessage> Create([FromBody] HiLo hilo) { if (hilo == null) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } else { using (var dbFactory = new DbContextFactory(this._env.EnvironmentName)) using (var allocatorMng = new AllocatorManager(dbFactory)) { bool isKeyExist = false; allocatorMng.CreateHiLoInstance(hilo, out isKeyExist); } // this.CreateHiLo(hilo); return(new HttpResponseMessage(HttpStatusCode.Created)); } }
static void Main(string[] args) { int input = 0; do { Game.PlayerScore = 0; Game.CPUScore = 0; Game.Count = 0; Game.FTShuffle = true; Game.WarInteract = false; Game.BJHands = 1; input = MainMenu(); try { switch (input) { case 1: HiLo.HiLoGame(); break; case 2: War.WarGame(); break; case 3: BlackJack.BJGame(); break; case 4: FiftyTwo.FiftyTwoGame(); break; } } catch (Exception e) { //Console.WriteLine(e); FinalScore(); } } while (input != 5); }