Example #1
0
        //Car model managment logic
        public ModelCarModel AddModelCar(ModelCarModel modelCar)
        {
            ModelsCar car = new ModelsCar
            {
                Model          = modelCar.model,
                ManufacturerId = modelCar.manufacturerId,
                PricePerDay    = modelCar.pricePerDay,
                Photo          = modelCar.photo
            };

            DB.ModelsCars.Add(car);
            DB.SaveChanges();

            return(GetOneModelCar(car.Id));
        }
Example #2
0
        public ModelCarModel UpdateModelCarPrice(ModelCarModel carModel)
        {
            ModelsCar car =
                DB.ModelsCars.Where(m => m.Id == carModel.id).SingleOrDefault();

            if (carModel == null)
            {
                return(null);
            }

            car.PricePerDay = carModel.pricePerDay;
            DB.SaveChanges();

            return(GetOneModelCar(car.Id));
        }
Example #3
0
 public bool CheckIfModelCarExists(ModelCarModel modelCarModel)
 {
     return(DB.ModelsCars.Any(m => m.Model == modelCarModel.model));
 }