//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)); }
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)); }
public bool CheckIfModelCarExists(ModelCarModel modelCarModel) { return(DB.ModelsCars.Any(m => m.Model == modelCarModel.model)); }