public async Task ApplyLogicAsync <T>(T obj, IPrincipal requestOwner) where T : class
        {
            if (!(obj is ITaggedItem))
            {
                return;
            }
            _tagDataService = Container.GetInstance <ITagDataService>();
            _unitOfWork     = Container.GetInstance <IUnitOfWork>();

            var taggedItem = obj as ITaggedItem;
            var tags       = new List <Tag>();

            taggedItem.Tags.ToList().ForEach(tags.Add);
            taggedItem.Tags.Clear();
            foreach (var tag in tags)
            {
                var dbtag = _tagDataService.Query.FirstOrDefault(x => x.Id == tag.Id);
                if (dbtag != null)
                {
                    taggedItem.Tags.Add(dbtag);
                    _unitOfWork.Entry(dbtag).State = EntityState.Unchanged;
                }
                else
                {
                    var urlBuilder = Container.GetInstance <IUrlBuilder>();
                    tag.Url    = urlBuilder.GenrateUrlSegment(tag.Title);
                    tag.Handle = urlBuilder.GenrateUrlSegment(tag.Title);
                    _unitOfWork.Entry(tag).State = EntityState.Added;
                    taggedItem.Tags.Add(tag);
                }
            }
        }
Ejemplo n.º 2
0
 public TagService(IUserService userService,
                   ITagDataService tagDataService,
                   IRealmDataService realmDataService,
                   IMapper mapper)
 {
     _userService = userService;
     _tagDataService = tagDataService;
     _realmDataService = realmDataService;
     _mapper = mapper;
 }
 //private readonly ITagPostDataService _dataService2;
 public TagController(ITagDataService dataService)
 {
     _dataService = dataService;
     //_dataService2 = dataService2;
     //Mapper.CreateMap<DomainModel.Post, Models.PostModel>();
     Mapper.Initialize(cfg => {
         //cfg.CreateMap<Source, Dest>();
         cfg.CreateMap <Tag, TagModel>();
         cfg.CreateMap <Tag, TagListModel>();
         cfg.CreateMap <TagPost, TagPostModel>();
         cfg.CreateMap <TagPost, TagPostListModel>();
     });
 }
Ejemplo n.º 4
0
        //ctr
        public AddRecipeViewModel(IRecipeDataService recipeData, ITagDataService tagData, ICategoryDataService categoryData, IFrameNavigationService navigationService)
        {
            _navigationService   = navigationService;
            _recipeDataService   = recipeData;
            _tagDataService      = tagData;
            _categoryDataService = categoryData;

            LoadCategories();

            LoadTags();

            AddRecipeCommand   = new RelayCommand(AddRecipe, () => IsRecipeValid());
            ResetRecipeCommand = new RelayCommand(ResetRecipe);
            AddTagCommand      = new RelayCommand(AddTag);
            RemoveTagCommand   = new RelayCommand <object>(RemoveTag);
        }
Ejemplo n.º 5
0
 public ProductWebClientService(IProductDataService productDataService,
                                IRestrictedItemAccessManager accessManager, IProductCategoryDataService productCategoryDataService,
                                IWorkContext workContext, IUnitOfWork unitOfWork, IProductReviewDataService productReviewDataService,
                                ISecurityLogger securityLogger, IOrderDataService orderDataService, ShoppingCartHelper shoppingCartHelper,
                                IDiscountWebClientService discountWebClientService, ITagDataService tagDataService,
                                ISettingService settingService, IIdentityManager identityManager,
                                IEntitySchemeDataService schemeDataService)
 {
     _productDataService         = productDataService;
     _accessManager              = accessManager;
     _productCategoryDataService = productCategoryDataService;
     _workContext = workContext;
     _unitOfWork  = unitOfWork;
     _productReviewDataService = productReviewDataService;
     _securityLogger           = securityLogger;
     _orderDataService         = orderDataService;
     _discountWebClientService = discountWebClientService;
     _tagDataService           = tagDataService;
     _settingService           = settingService;
     _identityManager          = identityManager;
     _schemeDataService        = schemeDataService;
     _currUserId = new Lazy <Guid>(_identityManager.GetCurrentIdentity().GetUserId().ToGuid);
 }
Ejemplo n.º 6
0
 public TagController(ITagDataService tagDataService)
 {
     this._tagDataService = tagDataService;
 }
 public TagService(ITagDataService tagSetDataService, IConfiguration config)
 {
     m_tagDataService = tagSetDataService;
     m_config         = config;
 }
 public TagController(ITagDataService tagDataService)
 {
     _tagDataService = tagDataService;
 }