Esempio n. 1
0
        public static async Task <int> GetNextId(CloudTable interventionsTable)
        {
            InterventionCountEntity counter = await GetCountEntity(interventionsTable);

            (int nextCount, TableOperation operation) = GetNextCount(counter);

            await interventionsTable.ExecuteAsync(operation);

            return(nextCount);
        }
Esempio n. 2
0
 private static (int, TableOperation) GetNextCount(InterventionCountEntity counter)
 {
     if (counter == null)
     {
         var newCounter = new InterventionCountEntity();
         return(newCounter.Count, TableOperation.Insert(newCounter));
     }
     else
     {
         return(++counter.Count, TableOperation.Replace(counter));
     }
 }