public void Excluir(int IdCliente) { //excluindo cliente ClienteRepositorio rep = new ClienteRepositorio(); rep.Delete(IdCliente); }
public void Delete(int id) { Cliente c = new Cliente(); c.Id = id; _ClienteRepositorio.Delete(c); }
//[Fact] //[Trait("Integration", "")] //[Trait("Repositorios", "")] public async Task CriarObterAtualizarExcluirCliente() { using (var context = new LanchoneteContext(ContextOptions <LanchoneteContext> .GetOptions())) { var repo = new ClienteRepositorio(context); var cliente = new Cliente("Fernando"); await repo.Insert(cliente); Assert.NotEqual(default(int), cliente.Id); var clienteObter = await repo.GetById(cliente.Id); Assert.Equal("Fernando", clienteObter.Nome); cliente.Alterar("Mendes"); await repo.Update(cliente); var clienteAtualizado = await repo.GetAllBy(c => c.Nome.StartsWith("Mend")); Assert.Equal("Mendes", clienteAtualizado.FirstOrDefault().Nome); await repo.Delete(cliente); var clienteExcluido = await repo.GetById(cliente.Id); Assert.Null(clienteExcluido); } }
private void btnDeletar_Click(object sender, EventArgs e) { ClienteRepositorio.Delete(Convert.ToInt32(dtgClientes.SelectedRows[0].Cells[0].Value)); btnListar.PerformClick(); LimparForms(); MessageBox.Show("Cliente deletado com sucesso."); }
// Excluir um cliente public HttpResponseMessage Delete([FromBody] int idCliente) { bool result = false; // Cria a instancia do repositório e exclui o cliente using (var _rp = new ClienteRepositorio()) { _rp.Delete(idCliente); result = true; } return(Request.CreateResponse(HttpStatusCode.OK, result, "application/json")); }
public ActionResult Delete(Cliente cliente) { try { repositorio.Delete(cliente); return(RedirectToAction("Index")); } catch { return(View(cliente)); } }
// // GET: /Cliente/Delete/5 public ActionResult Delete(int id) { try { IRepositorio<Cliente> repoCliente = new ClienteRepositorio(); repoCliente.Delete(repoCliente.GetById(id)); return RedirectToAction("Index"); }catch(Exception e) { } return RedirectToAction("Index"); }
public ActionResult Excluir(ClienteExcluirViewModel model) { try { int id = model.IdCliente; ClienteRepositorio rep = new ClienteRepositorio(); rep.Delete(id); ViewBag.Mensagem = "Cliente excluído com sucesso !"; } catch (Exception ex) { ViewBag.Mensagem = "Erro " + ex.Message; } return(View()); }
public CheckStatus Delete(int id) { CheckStatus checkstatus = new CheckStatus(); Cliente cliente = new Cliente(); cliente = productRepository.GetSingleByID(id); if (cliente != null) { cliente.Eliminado = true; checkstatus = productRepository.Delete(cliente); } else { checkstatus.message = "No existe"; checkstatus.status = Status.Error; } return(checkstatus); }
public void Deletar(Cliente cliente) { _clienteRepositorio.Delete(cliente); }
public void Excluir(Cliente c) { ClienteRepositorio rep = new ClienteRepositorio(); rep.Delete(c); }