public async Task <ActionResult> DeleteAsync([FromBody] DeleteSingleModel <long> deleteSingleModel) { if (deleteSingleModel == null) { return(BadRequest(MessageFactory.CreateParamsIsNullMessage())); } var result = await commandDemoService.DeleteAsync(deleteSingleModel).ConfigureAwait(false); return(Ok(result)); }
/// <summary> /// 删除单条索引 /// </summary> /// <param name="id">主键id</param> /// <param name="routing">路由键</param> /// <returns></returns> public async Task <HttpResponseResultModel <bool> > DeleteAsync <TPrimaryKeyType>(DeleteSingleModel <TPrimaryKeyType> deleteSingleModel) { HttpResponseResultModel <bool> httpResponseResultModel = new HttpResponseResultModel <bool>(); string indexName = deleteSingleModel.IndexName?.ToLower(); if (string.IsNullOrEmpty(indexName)) { indexName = PocoIndexName; } DeleteRequest deleteRequest = new DeleteRequest(indexName, deleteSingleModel.Id.ToString()); if (!string.IsNullOrEmpty(deleteSingleModel.Routing)) { deleteRequest.Routing = deleteSingleModel.Routing; } var result = await client.DeleteAsync(deleteRequest).ConfigureAwait(false); GetDebugInfo(result); httpResponseResultModel.IsSuccess = (result.Result == Result.Deleted); return(httpResponseResultModel); }
/// <summary> /// 根据根据主键删除 /// </summary> /// <param name="deleteSingleModel"></param> /// <returns></returns> public async Task <HttpResponseResultModel <bool> > DeleteAsync(DeleteSingleModel <long> deleteSingleModel) { return(await repository.DeleteAsync(deleteSingleModel).ConfigureAwait(false)); }