This commit is contained in:
2018-12-18 19:18:46 +00:00
parent 2be97c7d37
commit fe7104a999
2 changed files with 43 additions and 8 deletions

View File

@@ -2,6 +2,7 @@ using System.Collections.Generic;
using System;
using AyaNova.Util;
using System.Linq;
using AyaNova.Models;
namespace AyaNova.Biz
{
@@ -39,6 +40,45 @@ namespace AyaNova.Biz
}
public static void ProcessTagsIntoRepository(AyContext ct, List<string> addTags, List<string> removeTags)
{
//Add / increase reference count for added tags
//remove / decrease reference count for removed tags
var v=ct.Event.Any(x=>x.Textra=="word");
//https://stackoverflow.com/questions/10233298/increment-a-value-in-postgres
/*
ONE SHOT WAY WHICH IS BOSS!!
UPDATE totals
SET total = total + 1
WHERE name = 'bill';
If you want to make sure the current value is indeed 203 (and not accidently increase it again) you can also add another condition:
UPDATE totals
SET total = total + 1
WHERE name = 'bill'
AND total = 203;
*/
//WAY I PROBABLY SHOULD USE AND GROK for inventory later:
//https://stackoverflow.com/questions/14718929/best-practice-to-lock-a-record-for-editing-while-using-entity-framework
//Catch the concurrency exception, refetch and try again a certain number of times maximum until it's resolved
//maybe wrap that in a method I can re-use.
//Iterate remove tags
//Fetch the tag if it exists and decrement it's ref count
//Iterate addTags
//Fetch the tag if it exists and update it's ref count
}
/*