public async Task <IActionResult> Delete([FromRoute] Int32 brandId) { var deleted = await _brandService.DeleteBrandAsync(brandId); if (deleted) { return(NoContent()); } return(NotFound()); }
public async Task <IActionResult> DeleteBrand(string brandName) { var result = await _brandService.DeleteBrandAsync(brandName); if (!result) { return(NotFound(new Response <string>("The specified brand was not found."))); } return(Ok(new Response <string>("Brand deleted successfully."))); }
public async Task <IActionResult> Delete(int id) { var deleted = await _brandService.DeleteBrandAsync(id); if (deleted) { return(NoContent()); } return(NotFound()); }
public async Task <IActionResult> DeleteBrandAsync([FromRoute] Guid id) { var obj = await _brandService.GetBrandByIdAsync(id); if (obj == null) { return(NotFound()); } await _brandService.DeleteBrandAsync(id); return(NoContent()); }
public async Task <IActionResult> Delete(int?id) { if (id == null) { return(BadRequest()); } if (await _brandService.DeleteBrandAsync(id.Value)) { TempData["SuccessMessage"] = _localizer.GetLocalizedString("msg_DeleteBrandSuccess").ToString(); return(RedirectToAction(nameof(Index))); } TempData["ErrorMessage"] = _localizer.GetLocalizedString("err_DeleteBrand").ToString(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> DeleteBrand(int id) { var brand = await _brandService.GetBrandByIdAsync(id); if (brand == null) { return(BadRequest("Brand not found")); } await _brandService.DeleteBrandAsync(brand); return(Ok(new { status = 200, message = "Brand deleted successfully!" })); }
public async Task <IActionResult> Delete(string id) { string userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; var getOld = await _brandService.GetBrandById(id, userId); if (getOld == null) { return(NotFound()); } var deletedBrand = await _brandService.DeleteBrandAsync(id, userId); return(Ok(new OperationResponse <Brand> { IsSuccess = true, Message = $"{getOld.Name} has been deleted successfully!", Record = deletedBrand })); }
protected override async Task PerformDeleteAsync(int entityId) { await _brandService.DeleteBrandAsync(entityId); }
public async Task <IActionResult> DeleteConfirmed(int id) { await service.DeleteBrandAsync(id); return(RedirectToAction(nameof(Index))); }