Esempio n. 1
0
        public async Task <ActionResult> GetTags()
        {
            var tags = await _tagsService.GetAllAsync();

            if (tags == null)
            {
                return(NotFound());
            }

            return(Ok(_mapper.Map <List <TagResponse> >(tags)));
        }
        public async Task <IActionResult> GetAll()
        {
            var tags = await _tagsService.GetAllAsync();

            var response = _mapper.Map <List <TagResponse> >(tags);

            return(Ok(response));
        }
Esempio n. 3
0
 public async Task <ActionResult> Index() =>
 View(new DashboardViewModel
 {
     Users = await UserManager.Users.ToListAsync(),
     Posts = await _postsService.GetAllAsync(),
     Tags  = await _tagsService.GetAllAsync(),
     Roles = await RoleManager.Roles.ToListAsync(),
 });
Esempio n. 4
0
        public async Task <IHttpActionResult> GetAllAsync()
        {
            var courses = await _tagsService.GetAllAsync();

            if (courses == null)
            {
                return(NotFound());
            }

            return(Ok(courses));
        }
Esempio n. 5
0
        public async Task CreateAsync_InputIsValidTag()
        {
            // Arrange
            var tag = new Tag
            {
                Name      = "test",
                CreatedOn = DateTime.Now,
                CreatorId = "testUser"
            };

            // Act
            await _tagsService.CreateAsync(tag);

            var tags = await _tagsService.GetAllAsync();

            // Assert
            Assert.Single(tags);
        }
Esempio n. 6
0
 public async Task <IActionResult> Get() =>
 Ok(new { tags = await _tagsService.GetAllAsync() });
Esempio n. 7
0
 public async Task <List <TagsViewModel> > GetAllTags()
 {
     return(mapper.Map <List <TagsViewModel> >(await tagsService.GetAllAsync <Tags>().ConfigureAwait(false)));
 }