Example #1
0
        public async Task <ActionResult <ThemeDTO> > CreateThemeAsync(CreateThemeVM themeVM)
        {
            var createdTheme = await themeService
                               .CreateAsync(mapper.Map <ThemeDTO>(themeVM), GetCurrentUserId());

            return(CreatedAtAction(nameof(GetTheme), new { id = createdTheme.Id }, createdTheme));
        }
Example #2
0
        public async Task <IActionResult> Create(ThemeDto themeDto)
        {
            if (ModelState.IsValid)
            {
                await _themeService.CreateAsync(themeDto);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(themeDto));
        }
Example #3
0
        public async Task CreateTheme_AddItemToDb()
        {
            var countItemsImDataBase = await _context.Themes.CountAsync();

            await _service.CreateAsync(new ThemeDto()
            {
                Id = 3, Title = "Theme_3", Tests = new List <TestDto>()
            });

            _context.Themes.CountAsync().Result.Should().Be(countItemsImDataBase + 1);
        }