/// <summary> /// Hàm dùng chung xóa 1 bản ghi của 1 bảng /// </summary> /// <typeparam name="MISAEntity">Object của 1 bảng</typeparam> /// <param name="entityId">Khóa chính của bảng</param> /// <returns>Số bản ghi bị ảnh hưởng</returns> /// CreatedBy:LCQUYEN(10/03/2021) public ServiceResult Delete <MISAEntity>(Guid entityId) { serviceResult = new ServiceResult(); errorMsg = new ErrorMsg(); var rowEffect = _baseRespository.Delete <MISAEntity>(entityId); if (rowEffect > 0) { errorMsg.devMsg = Properties.Resources.Msg_DeleteSuccess; errorMsg.userMsg = Properties.Resources.Msg_DeleteSuccess; serviceResult.Sussess = true; serviceResult.Data = rowEffect; serviceResult.MISACode = MISAConst.Success; serviceResult.msg = errorMsg; return(serviceResult); } else { errorMsg.devMsg = Properties.Resources.ErrorMsg_DeleteFailed; errorMsg.userMsg = Properties.Resources.ErrorMsg_DeleteFailed; serviceResult.Sussess = false; serviceResult.Data = rowEffect; serviceResult.MISACode = MISAConst.IsNotValid; serviceResult.msg = errorMsg; return(serviceResult); } }
private async Task DeletetProduct(List <ProductEntity> throlledProductEntityObjects, string correlationToken) { await _productRepository.Delete(throlledProductEntityObjects, correlationToken); }
public IActionResult CheckConnections() { var configurationState = string.Empty; var correlationToken = Guid.NewGuid().ToString(); // Can I read UserSecrets and present configuration data configurationState = string.IsNullOrEmpty(configuration["ServiceBusPublisherConnectionString"]) ? "ServiceBus Connection string missing/n" : string.Empty; var serviceBusConnectionString = configuration["ServiceBusPublisherConnectionString"]; var topicName = configuration["ServiceBusTopicName"]; var subscriptionName = configuration["ServiceBusSubscriptionName"]; var storageAccount = configuration["StorageAccount"]; var storageKey = configuration["StorageKey"]; var storageTable = configuration["StorageTableName_Basket"]; var cosmosConnectionString = configuration["CosmosEndpoint"]; var cosmosKey = configuration["CosmosPrimaryKey"]; var databaseConnectonString = configuration["CatalogConnectionString"]; var connectionString = configuration["ServiceBusPublisherConnectionString"]; //var topicName = configuration["ServiceBusTopicName"]; //var subscriptionName = configuration["ServiceBusSubscriptionName"]; Guard.ForNullOrEmpty(connectionString, "ConnectionString from Catalog is Null"); Guard.ForNullOrEmpty(topicName, "TopicName from Catalog is Null"); Guard.ForNullOrEmpty(subscriptionName, "SubscriptionName from Catalog is Null"); //Can I connect to the SqlDB and query products? var products = musicRepository.GetAll(correlationToken); if (products.Count < 1) { throw new Exception("Error in Seed Catalog Read Table -- Cannot get reference to the Products Table"); } var productEntityObjects = products.Select(x => new ProductEntity { PartitionKey = ProductPartitionKey, RowKey = x.Id.ToString(), Title = x.Title, ArtistName = x.Artist.Name, Cutout = x.Cutout, GenreName = x.Genre.Name, ParentalCaution = x.ParentalCaution, Price = x.Price.ToString(), ReleaseDate = x.ReleaseDate, Upc = x.Upc }); try { var currentReadTableItems = productRepository.GetList(ProductPartitionKey).Result; var count = currentReadTableItems.Count(); // Empty product read table for (var i = 0; i < count; i++) { productRepository.Delete(currentReadTableItems[i].PartitionKey, currentReadTableItems[i].RowKey); } // Populate product read table foreach (var item in productEntityObjects) { productRepository.Insert(item, correlationToken); } } catch (Exception ex) { throw new Exception($"Could not build Catalog Read Table in DataInitializer. Message : {ex.Message}"); } // Can I connect to Azure Storage and query on baskets? // Can I connect to Azure Service Bus and ensure that each Topic and subscription is present? // Can I connect to CosmosDB and query for orders? configurationState = "This feature is not enabled\n\n"; return(Ok(configurationState)); }
//public async Task<bool> Update( // TEntity entity, // List<string> lstColumns = null, // List<string> lstIgnoreColumns = null, // string strWhere = "" // ) //{ // return await baseDal.Update(entity, lstColumns, lstIgnoreColumns, strWhere); //} /// <summary> /// 根据实体删除一条数据 /// </summary> /// <param name="entity">博文实体类</param> /// <returns></returns> public async Task <bool> Delete(TEntity entity) { return(await baseDal.Delete(entity)); }