public async void Save(IProduct product) { try { var table = AzureTableHelper.GetCloudTable(azureTableName); ProductDTO ent = new ProductDTO(GetNewPartitionKey(), GetNewUniqueKey()); ent.SetProduct(product); TableOperation ins = TableOperation.Insert(ent); await table.ExecuteAsync(ins); } catch (Exception ex) { throw ex; } }
public void Save(string JSONData) { try { var table = AzureTableHelper.GetCloudTable("HHIUnstructured"); var ent = new UnstructuredTable(GetNewUniqueKey(), GetNewUniqueKey()) { RawData = JSONData }; table.Execute(TableOperation.Insert(ent)); } catch (Exception ex) { throw ex; } }
public IEnumerable <IProduct> GetAll() { var retList = new List <Product>(); var table = AzureTableHelper.GetCloudTable(azureTableName); TableQuery <ProductDTO> query = new TableQuery <ProductDTO>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.NotEqual, "")); foreach (ProductDTO entity in table.ExecuteQuery(query)) { retList.Add(new Product() { Description = entity.Description, Id = entity.ProdId, Price = Convert.ToDecimal(entity.Price) }); } return(retList); }