public IActionResult Post([FromBody] Car value) { try { repo.AddCar(value); return(Ok(value)); } catch (Exception e) { return(StatusCode(500, e)); } }
private IdbCarModel AddCar(CarsRepository repository, long?ownerProfileId, long carBrandId, long carBrandModelId, string carNumber) { var addCarModel = new AddCarModel { OwnerProfileId = ownerProfileId, CarBrandId = carBrandId, CarModelId = carBrandModelId, CarNumber = carNumber }; return(repository.AddCar(addCarModel)); }
public void AddCars_Test() { //Arrange CarsRepository repo = new CarsRepository(); Car car = new Car { Id = 2, Make = "Murano", Model = "SL", Year = 2014, Manufacturer = "Nissan" }; //Act var inserted = repo.AddCar(car); //Assert Assert.IsTrue(inserted); }
public async Task AddCar() { var repository = new CarsRepository(); var car = new CarData { Id = Guid.NewGuid(), Make = "Ford", Model = "Mondeo", Year = 2007, FirstRegistration = new DateTime(2007, 01, 01), Generation = "Mk 4", Mileage = 275000, RegistrationNumber = "SCI 53366", Vin = "Vin number" }; await repository.AddCar(car); }
public async Task <string> AddCarMake([FromBody] CarMakeModel carMake) { await _repo.AddCar(carMake); return(carMake.CarMake); }
public async Task <string> AddCar([FromBody] CarModel car) { await _repo.AddCar(car); return(car.Registration); }