public async Task Save(Vehicle vehicle, long claimDbId)
        {
            var claimThirdInsured = ClaimThirdInsuredVehicleDB.NewInstance();

            claimThirdInsured.Vehicle = vehicle.Adapt <VehicleDB>();
            claimThirdInsured.ClaimId = claimDbId;
            claimThirdInsured.Claim   = null;
            applicationDbContext.ClaimThirdInsuredVehicles.Add(claimThirdInsured);
            applicationDbContext.SaveChanges();
        }
Esempio n. 2
0
        public async Task Update(Vehicle existingVehicle, Vehicle vehicleNewData)
        {
            var updatedVehicle = existingVehicle.Adapt <VehicleDB>();

            updatedVehicle.VehicleModel        = vehicleNewData.VehicleModel;
            updatedVehicle.VehicleManufacturer = vehicleNewData.VehicleManufacturer;
            updatedVehicle.VehicleTypeId       = vehicleNewData.VehicleTypeId;
            updatedVehicle.InsuranceCompanyId  = vehicleNewData.InsuranceCompanyId;
            updatedVehicle.DamageDetail        = vehicleNewData.DamageDetail;
            updatedVehicle.Franchise           = vehicleNewData.Franchise;
            updatedVehicle.HaveFullCoverage    = vehicleNewData.HaveFullCoverage;
            updatedVehicle.Patent = vehicleNewData.Patent;

            applicationDbContext.Vehicles.Update(updatedVehicle);
            applicationDbContext.SaveChanges();
        }