예제 #1
0
        public int SaveTemps(Temperature data)
        {
            DemoBaseContext context = new DemoBaseContext();

            context.Temperature.Add(data);
            context.SaveChanges();


            int count = context.Temperature.ToList().Count;

            return(count);
        }
예제 #2
0
        public int SaveShips(BattleShip data)
        {
            DemoBaseContext   context    = new DemoBaseContext();
            List <BattleShip> battleShip = context.BattleShip.Where(x => x.UserId == data.UserId).ToList();

            if (battleShip.Count() == 1)
            {
                battleShip[0].Score = data.Score;
                //context.SaveChanges();
            }
            else
            {
                context.BattleShip.Add(data);
            }

            context.SaveChanges();


            int count = context.BattleShip.ToList().Count;

            return(count);
        }