public IEnumerable <PilotListItem> Get([FromQuery] int?userID)
 {
     if (userID == null)
     {
         return(_aviBL.GetPilots().Select(pilot => PilotListItem.FromDLModel(pilot)));
     }
     return(_aviBL.GetPilotsByProducerID((int)userID).Select(pilot => PilotListItem.FromDLModel(pilot)));
 }
Ejemplo n.º 2
0
        public async Task PilotListItem_FromDLModelShouldMapToPilotListItem()
        {
            var newPilot = new Pilot
            {
                ID        = 1,
                PilotName = "name",
                Producer  = new User {
                    ID = 1, UserName = "******"
                },
                PilotDescription = "description",
            };
            var result = PilotListItem.FromDLModel(newPilot);

            Assert.Equal(newPilot.ID, result.ID);
            Assert.Equal(newPilot.PilotName, result.PilotName);
            Assert.Equal(newPilot.PilotDescription, result.PilotDescription);
        }
Ejemplo n.º 3
0
 public IEnumerable <PilotListItem> Get()
 {
     return(_aviBL.GetPilots().Select(pilot => PilotListItem.FromDLModel(pilot)));
 }