public TagsViewModel SearchResult(int currentUmbracoPageId, string tagText)
        {
            var _model = new TagsViewModel();

            var current = _umbracoHelper.TypedContent(currentUmbracoPageId);

            _model.articleListWithTag = new ArticleListWithTag(current);
            var mainNode        = current.AncestorOrSelf(2);
            var informationNode = mainNode.Descendant(DocumentTypeEnum.Information.ToString());

            var _newsNode = _umbracoHelper.TypedContent(informationNode.Id);
            var _newsList = _newsNode.Children.Where("Visible").Select(q => new ArticleWithDoubleFiltr(q));

            _model.NewsBoxesList = new List <TagItem>();
            foreach (var item in _newsList)
            {
                if (item.ArticleTag != null && item.ArticleTag.ToString().Contains(tagText))
                {
                    TagItem tagItem = new TagItem()
                    {
                        TagName = item.ArticleTitle,
                        Tagdesc = item.ListShortDescArticle.ToString(),
                        TagUrl  = item.Url
                    };
                    _model.NewsBoxesList.Add(tagItem);
                }
            }
            _model.TagText = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(tagText);
            return(_model);
        }
Exemple #2
0
        public async Task <IActionResult> Index()
        {
            ViewBag.Current = "Tags";

            var tags = await _tagService.GetAll();

            var tagsVm = new List <TagsViewModel>();

            foreach (var tag in tags.OrderBy(o => o.TagName))
            {
                var coverImageUri = await _galleryService.GenerateGalleryUri(1, tag.TagName, "custominclusive", "include");

                var coverImageGallery = await _galleryService.Get(coverImageUri);

                var coverImage = coverImageGallery.GalleryItems.Single();
                var vm         = new TagsViewModel
                {
                    CategoryName        = tag.TagName,
                    CoverImageAppPath   = coverImage.AppPath,
                    CoverImageMediaType = coverImage.MediaType,
                    ItemCount           = tag.ItemCount,
                };

                tagsVm.Add(vm);
            }

            return(View(tagsVm));
        }
Exemple #3
0
        public TagsView()
        {
            InitializeComponent();
            TagsViewModel viewModel = IoC.GetViewModel <TagsViewModel>(this);

            this.DataContext = viewModel;
        }
Exemple #4
0
        public async Task <IActionResult> Index(GetTagsRequest request)
        {
            var tagPage = await _tagManager.GetAsync(request.ToQuery(PageSize), Cancel);

            var viewModel = new TagsViewModel(tagPage, request.Page);

            return(View(viewModel));
        }
Exemple #5
0
        // test adding tag with a name
        public void AddCommandTest()
        {
            var vm = new TagsViewModel(new PageService());

            vm.Tagname.TagNames = "test";

            vm.CreateTags.CanExecute(null);

            Assert.AreEqual("test", vm.Tagname.TagNames);
        }
Exemple #6
0
        public ActionResult Put([FromBody] TagsViewModel value)
        {
            var reusult = _app.Update(value);

            if (reusult)
            {
                return(Ok());
            }

            return(BadRequest());
        }
Exemple #7
0
        // test adding tag with no name
        public void Addcommandwithnull()
        {
            var vm = new TagsViewModel(new PageService());

            vm.Tagname.TagNames = null;

            vm.CreateTags.CanExecute(null);

            // Assert.AreEqual("", vm.Tagname.TagNames);
            Assert.IsNull(vm.Tagname.TagNames);
        }
        /// <summary>
        /// 设置展示的标签 到ViewBag.Tags
        /// </summary>
        private TagsViewModel GetTags()
        {
            TagsViewModel viewModel = null;

            if (!this._memoryCache.TryGetValue(MemoryCacheKeys.Tags, out viewModel))
            {
                viewModel = this._viewProjectionFactory.GetViewProjection <TagsBindModel, TagsViewModel>(new TagsBindModel());
                this._memoryCache.Set(MemoryCacheKeys.Tags, viewModel);
            }
            return(viewModel);
        }
        public TagsViewController(string user, string slug)
        {
            Title             = "Tags".t();
            SearchPlaceholder = "Search Tags".t();
            NoItemsText       = "No Tags".t();
            EnableSearch      = true;
            ViewModel         = new TagsViewModel(user, slug);

            BindCollection(ViewModel.Tags, x => {
                return(new StyledStringElement(x.Name, () => NavigationController.PushViewController(new SourceViewController(ViewModel.Username, ViewModel.Repository, x.Commit.Sha), true)));
            });
        }
        public ActionResult AddTags()
        {
            var tags      = this.tagService.GetAll();
            var tagsModel = this.mappingService.Map <IEnumerable <Tag>, IList <TagAnnotaionViewModel> >(tags);

            var tagsViewModel = new TagsViewModel()
            {
                Tags = tagsModel
            };

            return(this.PartialView("_AddTags", tagsViewModel));
        }
Exemple #11
0
        public ActionResult TagsInput()
        {
            var viewModel = new TagsViewModel
            {
                CommaSeprated  = "Los Angeles, New Delhi, Kinshasa",
                Tags           = new[] { "Los Angeles", "New Delhi", "Kinshasa" },
                CommaSeprated2 = "Los Angeles, New Delhi, Kinshasa",
                Tags2          = new[] { "Los Angeles", "New Delhi", "Kinshasa" }
            };

            return(View(viewModel));
        }
        public async Task <IActionResult> Tags()
        {
            var tags = await _categoryService.GetAllCategoriesAsync();

            List <TagViewModel> result = _mapper.Map <List <TagViewModel> >(tags);
            TagsViewModel       vm     = new TagsViewModel()
            {
                Tags   = result,
                AddTag = new TagViewModel()
            };

            return(View(vm));
        }
Exemple #13
0
        public ActionResult Edit(TagsViewModel model)
        {
            try
            {
                _tagsAppService.Update(model);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ViewBag.Error = $"Erro ao carregar Tag Erro: {ex.Message}";
                return(View());
            }
        }
        public async Task <ContentDetailReturn> Handle(GetContentDetailRequest request, CancellationToken cancellationToken)
        {
            var content = _context.Tasks.AsNoTracking()
                          .Where(x => x.Id == request.IdTask)
                          .Select(x => new
            {
                x,
                Contents  = x.Contents.Where(c => c.IsActive == true).FirstOrDefault(),
                TasksTags = x.TasksTags.ToList(),
            }).FirstOrDefault();
            List <string> imgs = getImage(content.Contents.TheContent);

            if (imgs.Count == 0)
            {
                imgs.Add("https://marketingland.com/wp-content/ml-loads/2015/11/content-marketing-idea-lightbulb-ss-1920.jpg");
            }
            var Cnt = new ContentModels
            {
                Id      = content.Contents.Id,
                Content = content.Contents.TheContent,
                Name    = content.Contents.Name
            };
            var Writter = new UsersModels
            {
                Id   = content.x.IdWriter,
                Name = _context.Users.Find(content.x.IdWriter).Name
            };
            var lstTag = new List <TagsViewModel>();

            foreach (var item in content.TasksTags)
            {
                var Tag = new TagsViewModel
                {
                    Id   = item.IdTag,
                    Name = _context.Tags.Find(item.IdTag).Name
                };
                lstTag.Add(Tag);
            }
            var ContentReturn = new ContentDetailReturn
            {
                IdTask      = content.x.Id,
                PublishTime = content.x.PublishTime,
                Contents    = Cnt,
                Image       = imgs,
                ListTags    = lstTag,
                Writer      = Writter
            };

            return(ContentReturn);
        }
Exemple #15
0
        public IActionResult Tags(string imageName)
        {
            var result = _registryService.GetTags(imageName);

            if (result.IsLeft())
            {
                return(RedirectError("Can't get tag list from image: " + imageName));
            }

            var imageTags = result.Right;
            var model     = new TagsViewModel(imageTags.ImageName)
            {
                Tags = imageTags.TagList
            };

            return(View("Tags", model));
        }
        public ActionResult Index(Models.TagPage currentPage)
        {
            var model = new TagsViewModel(currentPage)
            {
                Locations = new List <LocationItemPage.Models.LocationItemPage>()
            };

            //Add theme images from results
            var carousel = new TagsCarouselViewModel
            {
                Items = new List <TagsCarouselItem>()
            };

            model.Carousel = carousel;

            return(View(model));
        }
Exemple #17
0
        public async Task <IEnumerable <Tag> > SaveTag(TagsViewModel model)
        {
            if (model.Id == 0)
            {
                db.Tags.Add(new Tag {
                    Name = model.Name
                });
            }
            else
            {
                var editTag = await db.Tags.Get(model.Id);

                editTag.Name = model.Name;
            }

            db.Save();

            return(db.Tags.GetAll());
        }
        public async Task <TasksViewModel> Handle(GetTaskDetailUpdateRequest request, CancellationToken cancellationToken)
        {
            var task = await _context.Tasks.AsNoTracking()
                       .FirstOrDefaultAsync(x => x.Id == request.IdTask);

            var edtId   = _context.Campaign.Find(task.IdCampaign).IdEditor;
            var lstTag  = new List <TagsViewModel>();
            var lstTags = _context.TasksTags.Where(x => x.IdTask == request.IdTask).ToList();

            foreach (var item in lstTags)
            {
                var tag = new TagsViewModel();
                tag.Name = _context.Tags.FirstOrDefault(x => x.Id == item.IdTag).Name;
                tag.Id   = item.IdTag;
                lstTag.Add(tag);
            }
            var Writter = new UsersModels
            {
                Id   = task.IdWriter,
                Name = _context.Users.FirstOrDefault(x => x.Id == task.IdWriter).Name
            };
            var Status = new StatusModels
            {
                Id    = task.Status,
                Name  = _context.StatusTasks.FirstOrDefault(x => x.Id == task.Status).Name,
                Color = _context.StatusTasks.FirstOrDefault(x => x.Id == task.Status).Color
            };
            var taskView = new TasksViewModel()
            {
                Title       = task.Title,
                Deadline    = task.Deadline,
                PublishTime = task.PublishTime,
                Writer      = Writter,
                Description = task.Description,
                Status      = Status,
                StartedDate = task.StartedDate,
                Id          = task.Id,
                Tags        = lstTag
            };

            return(taskView);
        }
Exemple #19
0
        public ActionResult Cadastrar(TagsViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }

                model.DataHoraCadastro = DateTime.Now;
                _tagsAppService.Add(model);

                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                ViewBag.Error = "Erro ao cadastrar nova Tag";
                return(RedirectToAction("Index"));
            }
        }
        public async Task <ActionResult> Index()
        {
            var vm = new TagsViewModel
            {
                Message = TempData["Message"]?.ToString()
            };

            var api     = CreateTrainingApi();
            var tagList = await api.GetTagsAsync(ProjectId);

            foreach (var tag in tagList.Tags.OrderBy(x => x.Name))
            {
                vm.Tags.Add(new TagsViewModel.Tag
                {
                    Id   = tag.Id,
                    Name = tag.Name
                });
            }

            return(View(vm));
        }
Exemple #21
0
 public TagsPage()
 {
     InitializeComponent();
     BindingContext = new TagsViewModel(new PageService());
 }
Exemple #22
0
        public async Task <TasksViewModel> Handle(CreateTaskRequest request, CancellationToken cancellationToken)
        {
            //var task = new Tasks
            //{
            //    IdCampaign = request.Task.IdCampaign,
            //    IdWriter = request.Task.IdWriter,
            //    Description = request.Task.Description,
            //    Deadline = request.Task.Deadline,
            //    PublishTime = request.Task.PublishTime,
            //    Title = request.Task.Title,
            //    StartedDate = DateTime.UtcNow,
            //    ModifiedDate = DateTime.UtcNow,
            //    Status = 1
            //};
            //contentodbContext.Tasks.Add(task);
            //await contentodbContext.SaveChangesAsync();
            //return task;
            var transaction = contentodbContext.Database.BeginTransaction();

            try
            {
                var Tags = new List <TasksTags>();

                foreach (var item in request.Task.Tags)
                {
                    var tag = new TasksTags {
                        IdTag = item.Id, CreatedDate = DateTime.UtcNow
                    };
                    Tags.Add(tag);
                }
                var task = new Tasks
                {
                    IdCampaign   = request.Task.IdCampaign,
                    IdWriter     = request.Task.IdWriter,
                    Deadline     = request.Task.Deadline,
                    Description  = request.Task.Description,
                    PublishTime  = request.Task.PublishTime,
                    Title        = request.Task.Title,
                    StartedDate  = DateTime.UtcNow,
                    ModifiedDate = DateTime.UtcNow,
                    TasksTags    = Tags,
                    Status       = 1
                };
                contentodbContext.Attach(task);
                contentodbContext.Tasks.Add(task);
                await contentodbContext.SaveChangesAsync(cancellationToken);

                var ReturnTags = new List <TagsViewModel>();

                foreach (var item in task.TasksTags)
                {
                    var tag = new TagsViewModel {
                        Id = item.IdTag, Name = contentodbContext.Tags.Find(item.IdTag).Name
                    };
                    ReturnTags.Add(tag);
                }
                var status = new StatusModels();

                status.Id    = task.Status;
                status.Name  = contentodbContext.StatusTasks.FirstOrDefault(x => x.Id == task.Status).Name;
                status.Color = contentodbContext.StatusTasks.FirstOrDefault(x => x.Id == task.Status).Color;

                var writer = new UsersModels
                {
                    Id   = task.IdWriter,
                    Name = contentodbContext.Users.FirstOrDefault(x => x.Id == task.IdWriter).Name
                };
                var taskModel = new TasksViewModel
                {
                    Deadline    = task.Deadline,
                    Writer      = writer,
                    Id          = task.Id,
                    Description = task.Description,
                    StartedDate = task.StartedDate,
                    PublishTime = task.PublishTime,
                    Tags        = ReturnTags,
                    Status      = status,
                    Title       = task.Title,
                };
                var upStatus = contentodbContext.Campaign.FirstOrDefault(y => y.Id == request.Task.IdCampaign);
                if (upStatus.Status == 1)
                {
                    upStatus.Status = 2;
                    contentodbContext.Attach(upStatus);
                    contentodbContext.Entry(upStatus).Property(x => x.Status).IsModified = true;
                    await contentodbContext.SaveChangesAsync(cancellationToken);
                }

                transaction.Commit();
                return(taskModel);
            }
            catch (Exception e)
            {
                transaction.Rollback();
                return(null);
            }
        }
Exemple #23
0
 public TagsPage()
 {
     InitializeComponent();
     BindingContext = tagsViewModel = new TagsViewModel(App.FilePath);
 }
Exemple #24
0
 public TagsWindow(QDMSClient.QDMSClient client)
 {
     InitializeComponent();
     ViewModel   = new TagsViewModel(client, DialogCoordinator.Instance);
     DataContext = ViewModel;
 }
        public async Task <TasksViewModel> Handle(StartTaskCommand request, CancellationToken cancellationToken)
        {
            var transaction = _context.Database.BeginTransaction();

            try
            {
                var newContent = new Contents
                {
                    CreatedDate = DateTime.UtcNow,
                    Version     = 1,
                    IdTask      = request.IdTask,
                    IsActive    = true
                };
                _context.Contents.Add(newContent);
                var upTask = _context.Tasks.AsNoTracking().Include(y => y.Contents).FirstOrDefault(x => x.Id == request.IdTask);
                upTask.Status = 2;
                _context.Attach(upTask);
                _context.Entry(upTask).State = EntityState.Modified;
                await _context.SaveChangesAsync(cancellationToken);

                // get detail task
                var task = await _context.Tasks.AsNoTracking().Include(i => i.Contents).FirstOrDefaultAsync(x => x.Id == request.IdTask);

                var content  = task.Contents.Where(x => x.IsActive == true).FirstOrDefault();
                var edtId    = _context.Campaign.Find(task.IdCampaign).IdEditor;
                var campaign = _context.Campaign.Find(task.IdCampaign).Title;
                var lstTag   = new List <TagsViewModel>();
                var lstTags  = _context.TasksTags.Where(x => x.IdTask == request.IdTask).ToList();
                foreach (var item in lstTags)
                {
                    var tag = new TagsViewModel();
                    tag.Name = _context.Tags.FirstOrDefault(x => x.Id == item.IdTag).Name;
                    tag.Id   = item.IdTag;
                    lstTag.Add(tag);
                }
                var Writter = new UsersModels
                {
                    Id   = task.IdWriter,
                    Name = _context.Users.FirstOrDefault(x => x.Id == task.IdWriter).Name
                };
                var Status = new StatusModels
                {
                    Id    = task.Status,
                    Name  = _context.StatusTasks.FirstOrDefault(x => x.Id == task.Status).Name,
                    Color = _context.StatusTasks.FirstOrDefault(x => x.Id == task.Status).Color
                };
                var Editor = new UsersModels
                {
                    Id   = edtId,
                    Name = _context.Users.FirstOrDefault(x => x.Id == edtId).Name
                };
                var Content = new ContentModels
                {
                    Id      = content.Id,
                    Content = content.TheContent,
                    Name    = content.Name
                };
                var taskView = new TasksViewModel()
                {
                    Title       = task.Title,
                    Deadline    = task.Deadline,
                    PublishTime = task.PublishTime,
                    Writer      = Writter,
                    Description = task.Description,
                    Status      = Status,
                    StartedDate = task.StartedDate,
                    Editor      = Editor,
                    Content     = Content,
                    Id          = task.Id,
                    Tags        = lstTag,
                    Campaign    = campaign
                };
                transaction.Commit();
                return(taskView);
            }
            catch (Exception)
            {
                transaction.Rollback();
                return(null);
            }
        }
Exemple #26
0
        public async Task <List <ContentViewer> > Handle(GetContentViewerRequest request, CancellationToken cancellationToken)
        {
            if (request.Tags.Count > 0 && !request.Tags.Contains(0))
            {
                var content = _context.Tasks.AsNoTracking()
                              .Where(x => x.Status == 7 &&
                                     x.Contents.Any(t => t.IsActive == true) &&
                                     x.TasksChannels.Any(t => t.IdChannel == 1) &&
                                     x.TasksTags.Any(z => request.Tags.Contains(z.IdTag)))
                              .OrderByDescending(x => x.PublishTime)
                              .Select(x => new
                {
                    x,
                    Contents  = x.Contents.Where(c => c.IsActive == true).FirstOrDefault(),
                    TasksTags = x.TasksTags.ToList()
                }).ToList();
                var lstContentReturn = new List <ContentViewer>();
                foreach (var item in content)
                {
                    List <string> imgs = getImage(item.Contents.TheContent);
                    if (imgs.Count == 0)
                    {
                        imgs.Add("https://marketingland.com/wp-content/ml-loads/2015/11/content-marketing-idea-lightbulb-ss-1920.jpg");
                    }
                    var Cnt = new ContentModels
                    {
                        Id   = item.Contents.Id,
                        Name = item.Contents.Name
                    };
                    var lstTag = new List <TagsViewModel>();
                    foreach (var item1 in item.TasksTags)
                    {
                        var Tag = new TagsViewModel
                        {
                            Id   = item1.IdTag,
                            Name = _context.Tags.Find(item1.IdTag).Name
                        };
                        lstTag.Add(Tag);
                    }
                    var ContentReturn = new ContentViewer
                    {
                        IdTask      = item.x.Id,
                        PublishTime = item.x.PublishTime,
                        Contents    = Cnt,
                        Image       = imgs,
                        ListTags    = lstTag
                    };
                    lstContentReturn.Add(ContentReturn);
                }

                return(lstContentReturn);
            }
            else
            {
                var content = _context.Tasks.AsNoTracking()
                              .Where(x => x.Status == 7 &&
                                     x.Contents.Any(t => t.IsActive == true) &&
                                     x.TasksChannels.Any(t => t.IdChannel == 1))
                              .OrderByDescending(x => x.PublishTime)
                              .Select(x => new
                {
                    x,
                    Contents  = x.Contents.Where(c => c.IsActive == true).FirstOrDefault(),
                    TasksTags = x.TasksTags.ToList()
                }).ToList();
                var lstContentReturn = new List <ContentViewer>();
                foreach (var item in content)
                {
                    List <string> imgs = getImage(item.Contents.TheContent);
                    if (imgs.Count == 0)
                    {
                        imgs.Add("https://marketingland.com/wp-content/ml-loads/2015/11/content-marketing-idea-lightbulb-ss-1920.jpg");
                    }
                    var Cnt = new ContentModels
                    {
                        Id   = item.Contents.Id,
                        Name = item.Contents.Name
                    };
                    var lstTag = new List <TagsViewModel>();
                    foreach (var item1 in item.TasksTags)
                    {
                        var Tag = new TagsViewModel
                        {
                            Id   = item1.IdTag,
                            Name = _context.Tags.Find(item1.IdTag).Name
                        };
                        lstTag.Add(Tag);
                    }
                    var ContentReturn = new ContentViewer
                    {
                        IdTask      = item.x.Id,
                        PublishTime = item.x.PublishTime,
                        Contents    = Cnt,
                        Image       = imgs,
                        ListTags    = lstTag
                    };
                    lstContentReturn.Add(ContentReturn);
                }

                return(lstContentReturn);
            }
        }
Exemple #27
0
 public async Task <IViewComponentResult> InvokeAsync(TagsViewModel model)
 {
     return(View(model));
 }
Exemple #28
0
 public bool Update(TagsViewModel entity)
 {
     return(_repo.Update(_mapper.Map <Tag>(entity)));
 }
Exemple #29
0
 public async Task <IHttpActionResult> SaveTag(TagsViewModel model)
 {
     return(Ok(await service.SaveTag(model)));
 }
        public async Task <TasksViewModel> Handle(GetTaskDetailRequest request, CancellationToken cancellationToken)
        {
            var task = await _context.Tasks.AsNoTracking().Include(i => i.Contents)
                       .FirstOrDefaultAsync(x => x.Id == request.IdTask);

            var edtId    = _context.Campaign.Find(task.IdCampaign).IdEditor;
            var content  = task.Contents.Where(x => x.IsActive == true).FirstOrDefault();
            var campaign = _context.Campaign.Find(task.IdCampaign).Title;
            var lstTag   = new List <TagsViewModel>();
            var lstTags  = _context.TasksTags.Where(x => x.IdTask == request.IdTask).ToList();

            foreach (var item in lstTags)
            {
                var tag = new TagsViewModel();
                tag.Name = _context.Tags.FirstOrDefault(x => x.Id == item.IdTag).Name;
                tag.Id   = item.IdTag;
                lstTag.Add(tag);
            }
            var Writter = new UsersModels
            {
                Id   = task.IdWriter,
                Name = _context.Users.FirstOrDefault(x => x.Id == task.IdWriter).Name
            };
            var Status = new StatusModels
            {
                Id    = task.Status,
                Name  = _context.StatusTasks.FirstOrDefault(x => x.Id == task.Status).Name,
                Color = _context.StatusTasks.FirstOrDefault(x => x.Id == task.Status).Color
            };
            var Editor = new UsersModels
            {
                Id   = edtId,
                Name = _context.Users.FirstOrDefault(x => x.Id == edtId).Name
            };
            var Content = new ContentModels
            {
                Id      = content.Id,
                Content = content.TheContent,
                Name    = content.Name
            };
            var Comment = new Comments();

            if (task.Contents.FirstOrDefault(x => x.IsActive == true).IdComment != null)
            {
                Comment.Comment = _context.Comments.FirstOrDefault(x => x.Id == content.IdComment).Comment;
            }

            var taskView = new TasksViewModel()
            {
                Title       = task.Title,
                Deadline    = task.Deadline,
                PublishTime = task.PublishTime,
                Writer      = Writter,
                Description = task.Description,
                Status      = Status,
                StartedDate = task.StartedDate,
                Editor      = Editor,
                Content     = Content,
                Comment     = Comment,
                Id          = task.Id,
                Tags        = lstTag,
                Campaign    = campaign
            };

            return(taskView);
        }