Exemple #1
0
        public void EditVehicule(VehiculeModel Vehi, string lat, string lon)
        {
            ProductCoordinateModel coor = dbb.ProductCoordinates.Find(Vehi.Coordinate.id);

            coor.Lat = lat;
            coor.Lon = lon;

            CategoryModel cate = dbb.Categories.FirstOrDefault(s => s.CategoryName == Vehi.Category.CategoryName);

            VehiculeModel model = dbb.Vehicules.FirstOrDefault(s => s.id == Vehi.id);

            model.id                   = Vehi.id;
            model.Title                = Vehi.Title;
            model.Description          = Vehi.Description;
            model.TypeVehicule         = Vehi.TypeVehicule;
            model.Town                 = Vehi.Town;
            model.Price                = Vehi.Price;
            model.Street               = Vehi.Street;
            model.BrandVehicule        = Vehi.BrandVehicule;
            model.ModelVehicule        = Vehi.ModelVehicule;
            model.RubriqueVehicule     = Vehi.RubriqueVehicule;
            model.PetrolVehicule       = Vehi.PetrolVehicule;
            model.FirstYearVehicule    = Vehi.FirstYearVehicule;
            model.YearVehicule         = Vehi.YearVehicule;
            model.MileageVehicule      = Vehi.MileageVehicule;
            model.NumberOfDoorVehicule = Vehi.NumberOfDoorVehicule;
            model.ColorVehicule        = Vehi.ColorVehicule;
            model.GearBoxVehicule      = Vehi.GearBoxVehicule;
            //model.ModelAccessoryAutoVehicule = Vehi.ModelAccessoryAutoVehicule;
            //model.ModelAccessoryBikeVehicule = Vehi.ModelAccessoryBikeVehicule;
            model.DateAdd        = DateTime.Now;
            model.SearchOrAskJob = Vehi.SearchOrAskJob;

            dbb.SaveChanges();
        }
Exemple #2
0
        public void AddVehicule(VehiculeModel model, string lat, string lon)
        {
            CategoryModel category = new CategoryModel
            {
                CategoryName = model.Category.CategoryName,
            };

            // dbb.Categories.Add(category);
            model.Category = category;

            ProductCoordinateModel coordinate = new ProductCoordinateModel
            {
                Lat = lat,
                Lon = lon
            };

            // dbb.ProductCoordinates.Add(coordinate);
            model.Coordinate = coordinate;

            dbb.Vehicules.Add(model);
            dbb.SaveChanges();
        }