public void Remove_ExistingName_Passes()
        {
            // arrange/given
            var request = VehiclesTestData.CreateCarRequest();

            _repo.Setup(r => r.Exists(request.Name)).Returns(true);

            // act/when
            var result = _unitUnderTest.Remove(request.Name);

            // assert/than
            Assert.IsTrue(result);
        }
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            _logger.LogInformation("Chamando metodo DeleteConfirmed para confirmar a exclusão do veiculos -> GET: Vehicles/Delete/5");
            await _vehiclesService.Remove(id);

            return(RedirectToAction(nameof(Index)));
        }
Beispiel #3
0
        public ActionResult DeleteConfirmed(string id)
        {
            try
            {
                var vehicles = vehiclesService.Get(id);

                if (vehicles == null)
                {
                    return(NotFound());
                }

                vehiclesService.Remove(vehicles.Id);

                return(RedirectToAction(nameof(Vehicles)));
            }
            catch
            {
                return(View());
            }
        }