This commit is contained in:
@@ -147,7 +147,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
//first, get an array of the tagId's in this group
|
||||
var tagGroupTags = await ct.TagGroupMap.Where(m => m.TagGroupId == tagGroupId).Select(m => m.TagId).ToArrayAsync();
|
||||
|
||||
|
||||
List<NameIdItem> l = new List<NameIdItem>();
|
||||
l = await ct.Tag
|
||||
.Where(m => tagGroupTags.Contains(m.Id))
|
||||
@@ -220,6 +220,29 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//TagObject
|
||||
internal async Task<List<NameIdItem>> TagObject(TagMapGroupInfo inObj)
|
||||
{
|
||||
var ReturnObject = new List<NameIdItem>();
|
||||
var TagGroupTags = await GetTagsInGroupPickListAsync(inObj.TagGroupId);
|
||||
if (TagGroupTags.Count == 0) return ReturnObject;
|
||||
|
||||
//Tag each one separately via TagMap which handles cases where object is already tagged with that tag etc
|
||||
var MapBiz = new TagMapBiz(ct, userId, userRoles);
|
||||
foreach (NameIdItem TagInGroup in TagGroupTags)
|
||||
{
|
||||
var TagMapItem = await MapBiz.CreateAsync(new TagMapInfo { TagId = TagInGroup.Id, TagToObjectId=inObj.TagToObjectId, TagToObjectType=inObj.TagToObjectType });
|
||||
ReturnObject.Add(TagInGroup);
|
||||
}
|
||||
await ct.SaveChangesAsync();
|
||||
|
||||
return ReturnObject;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//VALIDATION
|
||||
//
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace AyaNova.Biz
|
||||
//CREATE
|
||||
internal async Task<TagMap> CreateAsync(TagMapInfo inObj)
|
||||
{
|
||||
//TODO: Does object exist before attempting to tag it??
|
||||
|
||||
Validate(inObj, true);
|
||||
if (HasErrors)
|
||||
@@ -140,6 +141,9 @@ namespace AyaNova.Biz
|
||||
{
|
||||
//run validation and biz rules
|
||||
|
||||
|
||||
|
||||
|
||||
// //Name required
|
||||
// if (string.IsNullOrWhiteSpace(inObj))
|
||||
// AddError(ValidationErrorType.RequiredPropertyEmpty, "Name");
|
||||
|
||||
Reference in New Issue
Block a user