示例#1
0
        public IActionResult Post([FromBody] Car value)
        {
            try
            {
                repo.AddCar(value);
                return(Ok(value));
            }

            catch (Exception e)
            { return(StatusCode(500, e)); }
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
 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);
        }
示例#6
0
        public async Task <string> AddCar([FromBody] CarModel car)
        {
            await _repo.AddCar(car);

            return(car.Registration);
        }