Exemple #1
0
        public void Can_Get_All_Tags_From_Repository()
        {
            TagsRepository repository = new TagsRepository(ConfigurationManager.ConnectionStrings["TaskTracker"].ConnectionString);
            var            allTags    = repository.GetAll();

            Assert.That(allTags, Has.Count.GreaterThan(0));
        }
Exemple #2
0
        // TODO: rewrite this method
        public EditPodcastViewModel Edit(int podcastId)
        {
            var podcast   = _podcastRepository.GetPodcastForEdit(podcastId);
            var viewModel = new EditPodcastViewModel
            {
                Id          = podcast.Id,
                Title       = podcast.Title,
                Description = podcast.Description,
                ImageUrl    = podcast.ImageUrl,
                FeedUrl     = podcast.FeedUrl,
                SiteUrl     = podcast.SiteUrl
            };

            var tags = _tagsRepository
                       .GetAll()
                       .ToList();

            foreach (var tag in tags)
            {
                viewModel.Tags.Add(new CheckBoxListItem
                {
                    Id      = tag.TagId,
                    Display = tag.Name
                });
            }

            foreach (var tag in podcast.Tags)
            {
                var t = viewModel.Tags.Single(i => i.Id == tag.Id);
                t.IsChecked = true;
            }

            return(viewModel);
        }
Exemple #3
0
        // GET: Tags
        public ActionResult List(string tagfilter)
        {
            var Tags = tagsRepository.GetAll();

            if (tagfilter != null)
            {
                Tags = Tags.Where(e => e.TagDescription.ToLower().Contains(tagfilter)).ToList();
            }
            return(View(Tags));
        }
Exemple #4
0
        public void MethodGetAllTest()
        {
            var mockSet     = new Mock <DbSet <Tag> >();
            var mockContext = new Mock <ApplicationDbContext>();

            mockContext.Setup(m => m.Tags).Returns(mockSet.Object);
            mockSet.As <IEnumerable <Tag> >().Setup(m => m.GetEnumerator()).Returns((new List <Tag>()).GetEnumerator());

            IRepository <Tag> tagsRepository = new TagsRepository(mockContext.Object);
            var tags = tagsRepository.GetAll();

            Assert.IsNotNull(tags);
        }
Exemple #5
0
        public ReviewPodcastViewModel GetPodcastForReview(int podcastId)
        {
            var podcast   = _podcastRepository.GetPodcast(podcastId);
            var tags      = _tagsRepository.GetAll();
            var viewModel = new ReviewPodcastViewModel
            {
                Id      = podcast.Id,
                Title   = podcast.Title,
                SiteUrl = podcast.SiteUrl
            };

            foreach (var tag in tags)
            {
                viewModel.Tags.Add(new CheckBoxListItem
                {
                    Id      = tag.TagId,
                    Display = tag.Name
                });
            }

            return(viewModel);
        }
Exemple #6
0
 // TODO: Make access to all tags better for the users
 // [Authorize(Roles = RoleNames.Admin + "," + RoleNames.Moderator)]
 public async Task <ActionResult <IEnumerable <TagDto> > > GetAll()
 {
     return(await _tagsRepo.GetAll());
 }
 // GET: api/Tags
 public List <Tag> Get()
 {
     return(repository.GetAll());
 }
 internal IEnumerable <Tag> GetAll()
 {
     return(_repo.GetAll());
 }
 public IEnumerable <Tag> GetAll()
 {
     return(_repo.GetAll());
 }
Exemple #10
0
        public JsonResult Get()
        {
            var modelList = _repository.GetAll();

            return(Json(modelList));
        }