public ActionResult Delete(ModelViewModel model) { try { vehicleModelService.DeleteVehicleModel(AutoMapper.Mapper.Map <VehicleModel>(model)); return(View("Removal")); } catch (Exception) { ModelState.AddModelError("", "Something went wrong! Can't delete VehicleMake."); } return(RedirectToAction("Delete", model.Id)); }
public async Task ShouldDeleteModel() { //Arrange var modelId = 2; _modelRepoMock.Setup(x => x.Delete(modelId)).ReturnsAsync(true); //Act var result = await _sut.DeleteVehicleModel(modelId); //Assert result.Should().BeTrue(); }
public ActionResult DeleteConfirmed(int id) { vehicleModelLogic.DeleteVehicleModel(id); return(RedirectToAction("Index")); }