Пример #1
0
        public async Task AddSetAsync_WhenCalled_SaveSetInDbAsync()
        {
            var initialCount = _setUpContext.Sets.Count();
            var set          = new Set {
                Id = 5
            };

            await _setService.AddSetAsync(set);

            var currentCount = _context.Sets.Count();

            Assert.That(currentCount, Is.GreaterThan(initialCount));
        }
Пример #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            await _setService.AddSetAsync(this.Set);

            return(RedirectToPage("./Index"));
        }
Пример #3
0
        public async Task <IActionResult> Post([FromBody] SetDTO setDTO)
        {
            var result = await _setService.AddSetAsync(setDTO);

            return(Ok(result));
        }