示例#1
0
 public ICollection <PhotoListModel> GetPhotosByItemTag(ItemTagModel itemTagModel, int pageIndex, int pageSize = IoC.IoC.PageSize)
 {
     return(Mapper.PhotoEntitiesToPhotoListModels(_dataContext.Photos
                                                  .Where(x => x.Tags.Contains(Mapper.ItemTagModelToItemTagEntity(itemTagModel)))
                                                  .Skip((pageIndex - 1) * pageSize)
                                                  .Take(pageSize)
                                                  .ToList()));
 }
示例#2
0
 public static ItemTagEntity ItemTagModelToItemTagEntity(ItemTagModel itemTagModel)
 {
     return(new ItemTagEntity
     {
         Id = itemTagModel.Id,
         ItemId = itemTagModel.ItemId,
         XPosition = itemTagModel.XPosition,
         YPosition = itemTagModel.YPosition,
     });
 }
示例#3
0
        public async Task AttachTagsToItemAsync(IEnumerable <string> values, int itemId)
        {
            await ClearItemTags(itemId);

            var itemTags = new List <ItemTagModel>();
            var newTags  = await MaterializeTagsByValues(values);

            foreach (var tag in newTags)
            {
                var itemTag = new ItemTagModel
                {
                    ItemId = itemId,
                    TagId  = tag.Id
                };
                itemTags.Add(itemTag);
            }
            await itemTagCrudService.CreateRangeAsync(itemTags);
        }