public bool DeleteClient(DeleteClientViewModel deleteClient) { //throw new NotImplementedException(); Client client = new Client { Id = deleteClient.Id }; this.context.Clients.Remove(client); this.context.SaveChanges(); return(true); }
public IActionResult Delete(DeleteClientViewModel deleteClient) { bool result = clientServices.DeleteClient(deleteClient); if (!result) { return(View(deleteClient)); } else { return(Redirect("/Client/All/")); } }
public IActionResult DeleteConfirmation(int id) { if (id < 0) { return(NotFound()); } var _client = _clientRepo.GetById(id); if (_client == null) { return(NotFound()); } DeleteClientViewModel client = _mapper.Map <DeleteClientViewModel>(_client); return(PartialView("_DeleteConfirmation", client)); }
public IActionResult Delete(DeleteClientViewModel _client) { try { if (_client.Id < 0) { return(NotFound()); } var client = _clientRepo.GetById(_client.Id); if (client == null) { return(NotFound()); } _clientRepo.Delete(client); return(RedirectToAction(nameof(Index))); } catch { return(RedirectToAction(nameof(Index))); } }
private void Delete_Clicked(object sender, RoutedEventArgs e) { DataContext = new DeleteClientViewModel(); }