public async Task <ActionResult <Scouts> > PostScouts(Scouts scouts)
        {
            _context.Scouts.Add(scouts);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetScouts", new { id = scouts.ScoutId }, scouts));
        }
        public async Task <IActionResult> PutScouts(int id, Scouts scouts)
        {
            if (id != scouts.ScoutId)
            {
                return(BadRequest());
            }

            _context.Entry(scouts).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ScoutsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #3
0
 public Army(Leader leader, Scouts scouts, Spies spies, Logistics logistics, IEnumerable <Squad> squadrons)
 {
     Leader    = leader;
     Scouts    = scouts;
     Spies     = spies;
     Logistics = logistics;
     Squadrons = squadrons;
 }
        public void CreateSoldiers()
        {
            s  = new Soldier(general);
            s2 = new Scouts(general);

            while (_isRunning)
            {
            }
            //!!!!! 必须要手动 UNRegist
            s.g.rushBHandler  -= s.RushBWithP90;
            s2.g.rushBHandler -= s2.RushBWithKr98k;
        }
Beispiel #5
0
        public void LoadSampleData()
        {
            if (Scouts.Count() != 0)
            {
                return;
            }

            Tags.Add(badges[0].Tags[0]);
            Tags.Add(badges[0].Tags[1]);
            Tags.Add(badges[1].Tags[0]);
            Tags.Add(badges[1].Tags[1]);
            Badges.Add(badges[0]);
            Badges.Add(badges[1]);
            Scouts.Add(scouts[0]);
            Scouts.Add(scouts[1]);

            //SaveChanges();
        }
        public bool CreateScout(ScoutCreate model)
        {
            var entity =
                new Scouts()
            {
                ScoutId          = model.ScoutId,
                FirstName        = model.FirstName,
                LastName         = model.LastName,
                RegionRecruiting = model.RegionRecruiting,
                RecruitId        = model.RecruitId
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Scouts.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }