public async Task <IActionResult> Delete(int id) { var selectedMake = await vehicleMakeService.GetAsync(id); if (selectedMake == null) { return(NotFound()); } var deletedMake = await vehicleMakeService.DeleteAsync(id); return(NoContent()); }
public async Task <IActionResult> Delete(Guid id) { var result = await _vehicleMakeService.DeleteAsync(id); if (!result.Success) { return(BadRequest(result.Message)); } return(RedirectToAction("Index")); }
public async Task <IActionResult> Delete(int id) { try { await VehicleMakeService.DeleteAsync(id); return(Ok()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <ActionResult> Delete(int id, VehicleMakeDTO collection) { try { await _vehicleMakeService.DeleteAsync(id); return(RedirectToAction("Index")); } catch { return(View()); } }
public async Task <ActionResult> DeleteConfirmed(int id) { try { await MakeService.DeleteAsync(id); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public async Task <IActionResult> DeleteAsync(Guid id) { var result = await _vehicleMakeService.DeleteAsync(id); if (!result.Success) { return(BadRequest(result.Message)); } var vehicleMakeResource = _mapper.Map <VehicleMake, VehicleMakeResource>(result.VehicleMake); return(Ok(vehicleMakeResource)); }
public async Task <ActionResult> Delete(VehicleMakeViewModel model) { var vehicle = Mapper.Map <VehicleMakeViewModel, VehicleMake>(model); Mapper.AssertConfigurationIsValid(); if (vehicle != null) { await vehiclemakeService.DeleteAsync(vehicle.Id); return(RedirectToAction("Index")); } return(View(model)); }
public async Task <IHttpActionResult> Delete(int id) { try { Caching.InvalidateCache(MasterCacheKeyArray); await VehicleMakeService.DeleteAsync(id); return(Ok()); } catch (Exception ex) { LogError.LogError(ex); return(BadRequest(ex.Message)); } }
public async Task <ActionResult> DeleteConfirmedAsync(Guid id) { try { if (id != null) { await service.DeleteAsync(id); return(RedirectToAction("")); } else { return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } } catch (Exception ex) { // throw ex; return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, ex.Message)); } }