public IActionResult Delete(DeleteClientViewModel deleteClient) { bool result = clientServices.DeleteClient(deleteClient); if (!result) { return(View(deleteClient)); } else { return(Redirect("/Client/All/")); } }
public async Task <IActionResult> DeleteClientById([FromBody] Guid idClient) { var res = await _clientServices.GetClientByIdAsync(idClient); if (res == null) { return(NotFound($"Il n'existe pas un client avec l'id {idClient}")); } _clientServices.DeleteClient(res); if (await _clientServices.SaveChangeAsync()) { return(Ok("Client supprimé avec succès")); } return(BadRequest("Suppression échoué...")); }
public JsonResult DeleteClient(int Id) { try { _clientServices.DeleteClient(Id); return(Json(new { isDeleted = true, html = Helper .RenderRazorViewToString(this, "_ViewListClients", _clientServices.GetClients()) })); } catch (Exception ex) { Console.WriteLine(ex); return(Json(new { isDeleted = false, html = Helper .RenderRazorViewToString(this, "_ViewListClients", _clientServices.GetClients()) })); } }
public IActionResult DeleteClient(int id) { _clientServices.DeleteClient(id); return(Ok()); }