示例#1
0
        public async Task <Shuttle> CreateShuttleWithCrew(string shuttleName, int captainId)
        {
            Random  rnd      = new Random();
            int     crewSize = rnd.Next(2, 5);
            Shuttle shuttle  = new Shuttle
            {
                CaptainId = captainId,
                Name      = shuttleName
            };

            var robotList = await _robotRepository.GetAllQueryable().Where(x => x.ShuttleId == null).Take(crewSize).ToListAsync();

            shuttle.Robots = robotList;

            await _shuttleRepository.Create(shuttle);

            return(shuttle);
        }