Пример #1
0
        public IActionResult DeleteDriver(string id)
        {
            var deletedDriver = _carriersService.RemoveDriver(id);
            var carrierId     = deletedDriver.Carrier.Id;

            return(this.Redirect($"/Carriers/Edit?id={carrierId}"));
        }
Пример #2
0
        public void RemoveDriver_works_Properly()
        {
            string errorMessagePrefix = "CarriersService RemoveDriver() method does not work properly.";

            var context = OilsProDbContextInMemoryFactory.InitializeContext();

            this.carriersService = new CarriersService(context);

            var driver = new Driver
            {
                FullName = "Driver1"
            };

            context.Drivers.Add(driver);
            context.SaveChanges();

            var result = carriersService.RemoveDriver(driver.Id);

            Assert.True(result.isDeleted);
        }