private void DeletePersonButton_Click(object sender, EventArgs e) { if (DeletePerson != null) { DeletePerson.Invoke(); } }
private DeletePerson.Response DeletePersonHandler(DeletePerson command) { ITracer tracer = platform.Tracer; tracer.Write("Siemens-SimaticIT-Trace-Custom", Category.Informational, "Delete Person Start..."); try { var entity = platform.GetEntity <IPerson>(command.Id); if (entity == null) { return(new DeletePerson.Response { Error = new ExecutionError(-1010, "删除的对象不存在") }); } platform.Delete(entity); tracer.Write("Siemens-SimaticIT-Trace-Custom", Category.Informational, "Delete Person End..."); return(new DeletePerson.Response { }); } catch (Exception ex) { return(new DeletePerson.Response { Error = new ExecutionError(-1010, string.Format("删除发生异常,异常信息是:{0}", ex.Message)) }); } }
public DeletePersonViewModel( Messenger messenger, GetPeople getPeople, DeletePerson deletePerson) { _messenger = messenger; _deletePerson = deletePerson; People = new ObservableCollection <Person>(getPeople.Execute()); DeletePersonCommand = new RelayCommand(OnDeletePersonCommand, CanExecuteDeletePersonCommand); }
//Deletes public async Task <Unit> Handle(DeletePerson request, CancellationToken cancellationToken) { var person = await ctx.Persons.SingleOrDefaultAsync(v => v.Id == request.Id); if (person == null) { throw new Exception("Record not found"); } ctx.Persons.Remove(person); await ctx.SaveChangesAsync(); return(Unit.Value); }
public async Task <Unit> Handle(DeletePerson request, CancellationToken cancellationToken) { var person = await ctx.Persons.SingleOrDefaultAsync(v => v.Id == request.Id); if (person == null) { throw new Exception("Record does not exist"); } ctx.Persons.Remove(person); await ctx.SaveChangesAsync(); // await _bus.Publish<Message>(new { Value = person.Id.ToString() }); return(Unit.Value); }
public async Task <IActionResult> Delete(DeletePerson command) => await SendAsync(command.Bind(c => c.Id, UserId), resourceId : command.Id, resource : "people");
public Task Execute(DeletePerson c) => this.personRepository.Execute( c.PersonId, person => person.DeletePerson(c.PersonId));
public async Task <IActionResult> Delete(DeletePerson request) { await mediator.Send(request); return(Ok()); }
private void DeleteCustomer_OnClick(object sender, RoutedEventArgs e) { var deleteCustomerForm = new DeletePerson(new Customer()); deleteCustomerForm.Show(); }
private void DeleteEmployee_OnClick(object sender, RoutedEventArgs e) { var deleteEmployeeForm = new DeletePerson(new Employee()); deleteEmployeeForm.Show(); }
public async Task<ActionResult> Delete(DeletePerson deletePerson) { await _mediator.SendAsync(deletePerson); return RedirectToAction("Index"); }
// Delete endpoint to remove a person from the database public object Delete(DeletePerson request) { var delete = Db.DeleteById <Person>(request.id); return(delete); }
public PersonController(SavePerson savePerson, DeletePerson deletePerson, IPersonRepository repository) { _savePerson = savePerson; _deletePerson = deletePerson; _repository = repository; }
public void DeleteDeelnemer(DeletePerson deelnemer) { _sender.PublishCommand(deelnemer); }