Example #1
0
 /// <summary>
 /// Creates a new Airport Type record
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public async Task CreateAirport(Entities.Airport entity)
 {
     await _AirportStore.CreateAirport(mapper.ConvertModelToRepo(entity).Result);
 }
Example #2
0
 /// <summary>
 /// Updates an Existing Airport record with a changed data
 /// </summary>
 /// <param name="id"></param>
 /// <param name="updatedAirport"></param>
 /// <returns></returns>
 public async Task <bool> UpdateAirport(string id, Entities.Airport updatedAirport)
 {
     return(await _AirportStore.UpdateAirport(id, mapper.ConvertModelToRepo(updatedAirport).Result));
 }
        public static Expression <Func <Airport, bool> > GetPredicateBuilderForGetAirports(Entities.Airport airportEntity)
        {
            var predicate = PredicateBuilder.True <Airport>();

            if (airportEntity != null)
            {
                //Filter by AirportId
                if (airportEntity.AirportId > 0)
                {
                    predicate = predicate.And(where => where.AirportId.Equals(airportEntity.AirportId));
                }

                //Filter by Name
                if (!string.IsNullOrWhiteSpace(airportEntity.Name))
                {
                    predicate = predicate.And(where => where.Name.Equals(airportEntity.Name));
                }
            }

            return(predicate);
        }