예제 #1
0
        public List <ShipDTO> GetShips()
        {
            List <ShipDTO> returnvals = new List <ShipDTO>();

            using (var context = new XwingDataContext())
            {
                List <Ship> ships = context.Ship.Select(s => s).ToList();
                returnvals = ships.Select(s => s.ExtractDTO()).ToList();
            }
            return(returnvals);
        }
예제 #2
0
        public ShipListDTO GetShipList(int shiplistid)
        {
            ShipListDTO listdto = null;

            using (var context = new XwingDataContext())
            {
                ShipList shiplist = context.ShipList
                                    .FirstOrDefault(sl => sl.Id == shiplistid);
                listdto = shiplist.ExtractDTO();
            }
            return(listdto);
        }
예제 #3
0
        public List <FactionShipDTO> GetFactionShips()
        {
            List <FactionShipDTO> returnvals = new List <FactionShipDTO>();

            using (var context = new XwingDataContext())
            {
                List <FactionShipPilot> factionships = context.FactionShipPilot
                                                       .Select(f => f)
                                                       .Include(f => f.Faction)
                                                       .Include(f => f.Ship)
                                                       .Include(f => f.Pilot)
                                                       .ToList();
                returnvals = FactionShipPilot.ExtractFactionShipDTO(factionships);
            }
            return(returnvals);
        }