public async Task <ApiResult> Delete([FromUri] string id, CancellationToken cancelToken) { if (Authorization == null) { return(new ApiResult(APIResultCode.Unknown, APIResultMessage.TokenNull)); } if (string.IsNullOrWhiteSpace(id)) { throw new NotImplementedException("业户Id信息为空!"); } var user = _tokenManager.GetUser(Authorization); if (user == null) { return(new ApiResult(APIResultCode.Unknown, APIResultMessage.TokenError)); } await _industryRepository.DeleteAsync(new IndustryDto { Id = id, OperationTime = DateTimeOffset.Now, OperationUserId = user.Id.ToString() }, cancelToken); return(new ApiResult()); }
public async Task <Result <int> > Handle(DeleteIndustryCommand command, CancellationToken cancellationToken) { var item = await _repository.GetByIdAsync(command.Id); await _repository.DeleteAsync(item); await _unitOfWork.Commit(cancellationToken); return(Result <int> .Success(item.Id)); }
public async Task <ActionResultReponese <string> > DeleteAsync(string nameIndustry) { var isnameIndustry = await _iindustryRepository.checkexitNameIndustry(nameIndustry); if (!isnameIndustry) { return(new ActionResultReponese <string>(-31, "NameIndustry khong ton tai", "Industry")); } var getInfoIndustry = await _iindustryRepository.GetInfoAsync(nameIndustry); var Result = await _iindustryRepository.DeleteAsync(getInfoIndustry.IdIndustry); if (Result >= 0) { return(new ActionResultReponese <string>(Result, "Delete Nganh thanh cong", "Industry")); } return(new ActionResultReponese <string>(Result, "Delete Nganh that bai", "Industry")); }