Esempio n. 1
0
        public int AddToVehicleModel(PostVehicleArgs postveargs)
        {
            VehicleMakeEntity vehiclemakeentity = new VehicleMakeEntity();

            vehiclemakeentity.Name = postveargs.make_Name;
            vehiclemakeentity.Abrv = postveargs.make_Abrv;
            VehicleModelEntity vehiclemodelentity = new VehicleModelEntity();
            VehicleMakeEntity  findvehiclemake    = Context.VehicleMake.Find(postveargs.make_Id);

            if (findvehiclemake == null)
            {
                Context.VehicleMake.Add(vehiclemakeentity);
                Context.SaveChanges();
                vehiclemodelentity.MakeId = vehiclemakeentity.Id;
            }
            else
            {
                vehiclemakeentity.Id      = postveargs.make_Id;
                vehiclemodelentity.MakeId = postveargs.make_Id;
            }
            vehiclemodelentity.Id   = postveargs.model_Id;
            vehiclemodelentity.Name = postveargs.model_Name;
            vehiclemodelentity.Abrv = postveargs.model_Abrv;
            Context.VehicleModel.Add(vehiclemodelentity);
            return(Context.SaveChanges());
        }
Esempio n. 2
0
 public int AddToVehicleModel(PostVehicleArgs post)
 {
     return(Repository.AddToVehicleModel(post));
 }
 public int AddtoCars(PostVehicleArgs post)
 {
     return(Service.AddToVehicleModel(post));
 }