Esempio n. 1
0
        public IActionResult DeleteVehicle(string id)
        {
            var vehicle   = _carriersService.RemoveVehicle(id);
            var carrierId = vehicle.Carrier.Id;

            return(this.Redirect($"/Carriers/Edit?id={carrierId}"));
        }
Esempio n. 2
0
        public void RemoveVehicle_works_Properly()
        {
            string errorMessagePrefix = "CarriersService RemoveDriver() method does not work properly.";

            var context = OilsProDbContextInMemoryFactory.InitializeContext();

            this.carriersService = new CarriersService(context);

            var vehicle = new Vehicle
            {
                RegNumber = "RegNumber1"
            };

            context.Vehicles.Add(vehicle);
            context.SaveChanges();

            var result = carriersService.RemoveVehicle(vehicle.Id);

            Assert.True(result.isDeleted);
        }