public async Task <IActionResult> Deactivate(long id) { try { await _supplierService.Deactivate(id); _toastNotification.AddSuccessToastMessage("Successfully Deactivated!"); } catch (Exception ex) { _toastNotification.AddErrorToastMessage(ex.Message); } return(RedirectToAction("Index")); }
public async Task <ActionResult> Deactivate(long id) { try { await _supplierService.Deactivate(id); var Supplier = await _supplierRepo.GetById(id) ?? throw new Exception("Supplier Not Found."); return(Ok(CreateReponseDto(Supplier))); } catch (Exception ex) { return(BadRequest(ex.Message)); } }