public async Task <IActionResult> Delete(int id) { if (id <= 0) { return(BadRequest("Please specify correct Product Id")); } return(Ok(await _productsService.DeleteProductAsync(id))); }
public async Task <ActionResult> Delete(int id) { if (await _productsService.GetProductAsync(id) == null) { return(NotFound()); } await _productsService.DeleteProductAsync(id); return(NoContent()); }
public async Task <IActionResult> DeleteProduct(int id) { var products = await _productsService.GetProductsAsync(); if (!products.Any(product => product.Id == id)) { return(BadRequest("Product id not found")); } await _productsService.DeleteProductAsync(id); return(Ok(id)); }
public async Task <IActionResult> Delete(int id) { try { await _productsService.DeleteProductAsync(id); } catch (EntityNotFoundException) { return(NotFound($"Product with id {id} was not found")); } return(NoContent()); }
public Task Delete(int productId) { return(_productsService.DeleteProductAsync(productId, HttpContext.RequestAborted)); }
public async Task <IActionResult> DeleteProductAsync(int id) { return(await _productsService.DeleteProductAsync(id)); }
public async Task <IActionResult> DeleteProduct(int id) { var response = await _productsService.DeleteProductAsync(id); return(Ok(response)); }
public async Task <IActionResult> DeleteConfirmed(int id) { await _productsService.DeleteProductAsync(id); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> DeleteProductAsync(int id) { ProductViewModel productViewModel = await _productsService.DeleteProductAsync(id); return(new OkObjectResult(productViewModel)); }
public async Task <IActionResult> DeleteProductById(int id) { await _productsService.DeleteProductAsync(id); return(NoContent()); }