public async Task <StatusCodeResult> Delete(int id) { if (await _service.DeleteAsync(id) == 1) { return(StatusCode((int)HttpStatusCode.OK)); } else { return(StatusCode((int)HttpStatusCode.ExpectationFailed)); } }
public async Task <ActionResult> DeleteSingleWorkshopService([FromRoute] int workshopId, [FromRoute] int serviceId) { Service service = await _serviceRepo.GetWorkshopSingleService(workshopId, serviceId); if (service == null) { return(NotFound(new { error = $"service with id {serviceId} could not be found in workshop with id {workshopId}" })); } else { await _serviceRepo.DeleteAsync(service); return(NoContent()); } }
public async Task <IActionResult> DeleteService([FromForm] long Id) { try { if (Id <= 0) { return(StatusCode((int)System.Net.HttpStatusCode.BadRequest, "Id not found!")); } else { var result = await _serviceRepo.DeleteAsync(Id); return(Ok()); } } catch (Exception ex) { return(StatusCode((int)System.Net.HttpStatusCode.InternalServerError, ex.Message)); } }
public async Task <IActionResult> DeleteConfirmed(int id) { try { var service = await _serviceRepository.GetByIdAsync(id); await _serviceRepository.DeleteAsync(service); } catch (Exception ex) { if (ex.InnerException.Message.Contains("REFERENCE constraint")) { ViewBag.Error = $"This service is provided by dealerships, fist deactivate service and then update dealership in edit mode"; return(View()); } else { ModelState.AddModelError(string.Empty, ex.InnerException.Message); } } return(RedirectToAction(nameof(Index))); }
public IActionResult Delete(int id) { var res = catRepository.DeleteAsync(id).Result; return(RedirectToAction("Index")); }
public async Task Delete(int id) { await _serviceRepository.DeleteAsync(id); }
public async Task DeleteService(ServiceRequestModel serviceRequestModel) { var service = _mapper.Map <Service>(serviceRequestModel); await _serviceRepository.DeleteAsync(service); }
async Task <bool> IServiceManager.Delete(Guid serviceId) { await _serviceRepository.DeleteAsync(serviceId); return(true); }
public async Task <Response> Handle(DeleteService request, CancellationToken cancellationToken) { await serviceRepository.DeleteAsync(request.Id); return(new Response("Serviço excluido com sucesso!")); }
public async Task <int> DeleteServiceAsync(int id) { return(await _repository.DeleteAsync(id)); }
public IActionResult Delete(int id, Category cat) { var res = repository.DeleteAsync(id).Result; return(Ok(res)); }
public Task DeleteService(int id) { return(_serviceRepository.DeleteAsync(id)); }