public async Task <APIResult> Delete([FromBody] DeleteMaterialCommand command) { var rs = await mediator.Send(command); return(new APIResult() { Result = rs }); }
public Task <bool> Handle(DeleteMaterialCommand message, CancellationToken cancellationToken) { if (!message.IsValid()) { return(Task.FromResult(false)); } foreach (var item in message.Ids) { var existing = repository.Get(item); if (existing != null) { existing.Delete(); repository.Update(existing); } } return(Task.FromResult(false)); }
public void Delete(Guid[] ids) { var deleteCommand = new DeleteMaterialCommand(ids); }