Esempio n. 1
0
        internal static void SetDefault()
        {
            SetDefaultAirPlaneModels();

            var AirbusA300B1 = new AirPlaneModel()
            {
                Id    = Guid.Parse("b413cfc0-f53a-4765-9430-3912efcd79cb"),
                Code  = "1",
                Model = AirPlanModels.First(x => x.Name == "Airbus A300B1"),
                NumberOfPassengers = 111,
                CreationDate       = DateTime.Now
            };

            var AirbusA319 = new AirPlaneModel()
            {
                Id    = Guid.Parse("b413cfc0-f53a-4765-9430-3912efcd79cb"),
                Code  = "2",
                Model = AirPlanModels.First(x => x.Name == "Airbus A319"),
                NumberOfPassengers = 122,
                CreationDate       = DateTime.Now
            };

            var Boeing737_100 = new AirPlaneModel()
            {
                Id    = Guid.Parse("a714554f-f363-42f1-b41a-81ee85186660"),
                Code  = "3",
                Model = AirPlanModels.First(x => x.Name == "Boeing 737-100"),
                NumberOfPassengers = 167,
                CreationDate       = DateTime.Now
            };

            var Boeing737_100_2 = new AirPlaneModel()
            {
                Id    = Guid.Parse("a714554f-f363-42f1-b41a-81ee85186622"),
                Code  = "3B",
                Model = AirPlanModels.First(x => x.Name == "Boeing 737-100"),
                NumberOfPassengers = 167,
                CreationDate       = DateTime.Now
            };

            var BoeingCRJ_100 = new AirPlaneModel()
            {
                Id    = Guid.Parse("a714554f-f363-42f1-b41a-81ee85186661"),
                Code  = "4",
                Model = AirPlanModels.First(x => x.Name == "Boeing CRJ-100"),
                NumberOfPassengers = 117,
                CreationDate       = DateTime.Now
            };

            AirPlanes = new List <AirPlaneModel>
            {
                AirbusA300B1,
                AirbusA319,
                Boeing737_100,
                Boeing737_100_2,
                BoeingCRJ_100
            };
        }
        /// <summary>
        /// get AirPlane and AirPlaneModel with param and fill AirPlane dependency
        /// </summary>
        /// <param name="airplaneId"></param>
        /// <param name="airplaneModelId"></param>
        /// <returns></returns>
        public AirPlane GetEntity(Guid airplaneId, Guid airplaneModelId)
        {
            AirPlane      airplane      = _IAirPlane.GetEntity(airplaneId);
            AirPlaneModel airplaneModel = _IAirPlaneModel.GetEntity(airplaneModelId);

            airplane.Model = airplaneModel;

            return(airplane);
        }
        /// <summary>
        /// get AirPlane with AirPlaneModel associated
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public AirPlane GetEntity(Guid id)
        {
            AirPlane      aiplane       = _IAirPlane.GetEntity(id);
            AirPlaneModel aiplanesModel = _IAirPlaneModel.GetEntity(aiplane.ModelId);

            aiplane.Model = aiplanesModel;

            return(aiplane);
        }
Esempio n. 4
0
        private AirPlaneModel InsertAirPlane(AirPlaneAddModel airPlane)
        {
            if (AirPlaneRepository.AirPlanes.Any(x => x.Code.Equals(airPlane.Code, StringComparison.OrdinalIgnoreCase)))
            {
                return(null);
            }

            var entity = new AirPlaneModel(airPlane);

            AirPlaneRepository.AirPlanes.Add(entity);
            return(entity);
        }
Esempio n. 5
0
 private void AlterAirPlane(AirPlaneModel selectedAirPlane, AirPlaneAlterModel airPlane)
 {
     selectedAirPlane.Model.Id = airPlane.Model.Id;
     selectedAirPlane.Code     = airPlane.Code;
 }
 public int Update(AirPlaneModel Entity)
 {
     return(this._IAirPlaneModel.Update(Entity));
 }
 public int Delete(AirPlaneModel Entity)
 {
     return(this._IAirPlaneModel.Delete(Entity));
 }
 public int Add(AirPlaneModel Entity)
 {
     return(this._IAirPlaneModel.Add(Entity));
 }